A friend of mine who is a petroleum engineer recently told me about a problem he was having. He was launching a series of batch jobs (big simulation jobs) on his Windows XP workstation from the command line by running a batch file that contained a series of commands like job5.exe -i input.dat, and his problem was that these jobs were hogging so much of his machine's processing power that foreground tasks became unresponsive. Once these processes were running however, he could open Task Manager and change their priority to Low, and then he could work normally on the machine while the jobs ran in the background. He was wondering if there was a way to start an application with Low priority instead of Normal.
It turns out there are several solutions to this problem. A simple approach is to use the start command to launch each job with Low priority as follows:
start /low /b job5.exe -i input.dat
The /b switch causes the job to run in the current command window but with Low priority. Another solution would be:
start "Job #1" /low job5.exe -i input.dat
This runs the job in a separate command window with "Job #1" in the title bar to distinguish it from the spawning command window in which the batch file itself runs. Still another solution is to do this:
start "Low cmd" /low cmd.exe
This opens a new command window where the cmd.exe process has Low priority and the window's title bar displays "Low cmd." Once this new command window is open, you can run your batch file in it and all jobs spawned by the batch file will run with Low priority also. Still another variation of this is:
start /low /b cmd.exe
This runs a second cmd.exe process with Low priority within your visible Normal priority command window, and again running the batch file will launch all your jobs with Low priority.