In popular Unix/Linux shells, there is an option to start a process in the “background” by (i.e. in bash) typing “./something &“, or pressing Ctrl-Z and then “bg“. The process then prints its output to stdout as usual, but the bash runs in the foreground and receives console stdin.
In Windows, something similar (much less powerful than the bash “jobs”, though) can be done by doing: start /b something
This runs the process in the background, and its output is printed to your stdout, even though cmd continues running immediately and receives your stdin. (If the process tries to read from stdin, weird things happen that I can’t explain.)
If you do “start something” without the “/b” switch, the process runs in another window, which closes when it exits.
Another switch for “start” is /priority, where priority is the name of a process priority. This can be combined with /b to give you:
start /b /realtime pslist
to get a pslist output that runs in realtime priority.
Important note about this: You may think this is unnecessary if your cmd already runs in high priority, because the priority will carry on to the child process by default anyway, right?
Wrong! Here is the relevant excerpt from the documentation of the CreateProcess function:
- [in] Flags that control the priority class and the creation of the process. For a list of values, see Process Creation Flags.This parameter also controls the new process’s priority class, which is used to determine the scheduling priorities of the process’s threads. For a list of values, see GetPriorityClass. If none of the priority class flags is specified, the priority class defaults to NORMAL_PRIORITY_CLASS unless the priority class of the creating process is IDLE_PRIORITY_CLASS or BELOW_NORMAL_PRIORITY_CLASS. In this case, the child process receives the default priority class of the calling process.
Well, that was news to me, anyway.
I really recommend reading start /? and cmd /?, to catch up with the other cool features you didn’t know about.