Friday, December 30, 2011

Hide Flashing Command Line and Batch File Windows On Startup



I use a lot of batch files, command line applications, and even Ruby scripts (which run from the command line). One of the things that has always irritated me is the flashing command prompt window when I make a shortcut for a batch file, especially when I put it into the startup folder to run when I first login.
There’s a really useful utility that you can use called Hidden Start (hstart), which will start up a command line application hidden in the background, which eliminates the flashing window.
If you launch the utility with no parameters, it will pop up the settings dialog.


When using this utility, there are three key things to remember: Use the /NOWINDOW parameter to keep the window hidden, use the /D=path argument to make sure that the current directory is set correctly, and make sure to surround your application argument with quotes.
For instance, if I had a batch file stored in c:\scripts\mybatch.bat, I would start it by using the following parameters in my shortcut:
hstart /NOWINDOW /D=c:\scripts “c:\scripts\mybatch.bat”
You’ll probably want to copy hstart.exe into somewhere in the system path, for instance C:\windows might work nicely.

No comments:

Post a Comment