Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Command Prompt in a Batch File

Status
Not open for further replies.

MrTBC

Technical User
Nov 19, 2003
610
US
Hi there.
I'm using a batch file to automatiaclly start an app for a user when they logon. I'm using a ping command to pause briefly while the network catches up. This works correctly except that a command line window is displayed. Is there any way to hide/minimise it please?
My bacth file:

@echo off
PING 1.1.1.1 -n 1 -w 5000 >NUL
f:\appstart.exe
 
try echo without "@" and put "exit" at the end of file.

echo off
PING 1.1.1.1 -n 1 -w 5000 >NUL
f:\appstart.exe
exit


 
Hi there.
That still shows the command prompt window unfortunately.
 
what are you trying to do with this batch file?
why pinging and taking no action?
the reason for the prompt showing, is the delay that you have.
what's the purpose of this file?
can you explain?
 
Couldn't you just add a scheduled task that runs at logon and starts the app? Start/Programs/Accessories/System Tools/Scheduled Tasks.

Regards

Nelviticus
 
The user wants an app to start automatically when they logon. I have tried to do this simply by placing a shortcut in the startup directory but this doesn't work because the shortcut points to an exe on a network drive, and the network hasn't quite 'caught up' by the time they log on. I need to create some kind of delay before this happens - hence the ping command to create a five second pause.
 
Hi, MrTBC

In the shortcut pointing to your .cmd file, edit the properties and on the shortcut tab next to "Run" where it defaults to "Normal window" select "Minimized" instead.

Then it will run on the startbar.

Jock
 
I guess an easier alternative may be to use a VBS script or a scripting language like AutoIt or AutoHotKey which has 'sleep' and 'run' commands built-in.

AutoHotkey also has 'if exists' which can be used to check for the availability of a (network-based) file/folder.

I use AutoIt and AutoHotkey at work, for example, to run network-based programs automatically from startup for blind users.

Once I'm happy with a script then I compile the script as an exe and run it from a shortcut in the 'Startup' folder. The exe's are tiny and prevent the need to install anything, e.g. the ActiveX version of AutoIt.

AutoIt

AutoHotKey

Hope this helps...
 
Have you tried this?

@echo off
PING 1.1.1.1 -n 1 -w 5000 >NUL /min
f:\appstart.exe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top