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.
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 03/15/07