A few weeks ago, I was at a real estate office. As the agent worked on her computer, I noticed that the program she was running would occasionally open a DOS window and run a simple process, such as capturing a printer, before returning to the main program. At first I didn't think much of this, but then I noticed that the DOS window contained a custom title. It seemed odd that the programmer had taken the easy way out by calling a DOS session, and then gone through the trouble of writing a routine to generate a custom title for the DOS window.
Later, when doing unrelated research, I ran across Windows 2000's Start command. As I read about this command, I discovered that it could have been used for the program I described. In this article, I'll introduce you to this command.
The Start command's main purpose is to let you open a separate window to run a DOS or Windows program. Perhaps the most common use for the Start command is to imbed it in a batch file. Doing so gives you the ability to write some very powerful batch files, because you can spawn off independent windows of higher-level code.
The syntax for the Start command is as follows:
START ["title"] [/path] [/I] [/MIN] [/MAX]
[/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME |
/ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
In this syntax, the title refers to the description at the top of the new window. The path is the directory that the application will be started in. You can also specify the /I switch, which tells Windows to start the new application using the environment that was originally used to call CMD.EXE, not the current environment. The Start command even gives you the option of running the new application in a window that has been either minimized or maximized via the /MIN and /MAX switches.
As you probably know, Windows 2000 normally runs all 16-bit applications in a single memory space and at a set priority. However, you can get around this limitation. You can use the /SHARED or /SEPARATE switch to run the program in either a shared or a separate memory space. Likewise, you can control the program's priority level through the /LOW, /NORMAL, /HIGH, /REALTIME, /ABOVENORMAL, and /BELOWNORMAL switches.
If you want the main program to stop running until the spawned program has completed, you can use the /WAIT switch. One final option that you can use is the /B switch, which runs the program without opening a new window.
Once you've entered the desired command-line switches, simply follow them with the path and filename of the program and any optional parameters that the program may require. //
Brien M. Posey is an MCSE who works as a freelance writer. His past experience includes working as the director of information systems for a national chain of health care facilities and as a network engineer for the Department of Defense. Because of the extremely high volume of e-mail that Brien receives, it's impossible for him to respond to every message, although he does read them all.