pv.exe – PrcView command line utility allows automating common task like figuring out if particular process is running or killing a running process on scheduler. Checking if a particular process is running is easy. For example the following command will show all instances of explorer that are running: pv explorer.exe Setting a process priority is another common task. To set explorer priority to normal just type: pv –pn explorer.exe or if you like a ‘verbose’ style pv -p"Normal" explorer.exe pv supports the common ‘*’ and ‘?’ wildcards so that the following command will perfectly work by printing out all the processes starting with ‘e’ pv e* Don’t like a particular process and would like to kill it? The following command will do the job: pv –k thisprocess.exe And if you don’t like additional questions and would like to force killing: pv –kf thisprocess.exe Don’t like this particular instance of the process and know the window title? The following command will do the job (please note that ‘\’ need to be represented as a ‘\\’ combination if you enter it from the command line): pv -k thisprocess.exe -w"c:\\" pv.exe can be easealy executed from a batch file to check if process is running. When writing a command file please note that the ERRORLEVEL number specifies a true condition if the last program run returned an exit code equal to or _greater_ than the number specified. The following script illustrates how this could be done: @echo off pv.exe %1 >nul if ERRORLEVEL 1 goto Process_NotFound :Process_Found echo Process %1 is running goto END :Process_NotFound echo Process %1 is not running goto END :END Please note that redirecting standard errors by using 2>file_name does not work under 9x Windows. Please use "2>file_name" instead. This notation will be processed by pv.exe. And finally a copy of the -? command: pv displays information about the running processes. pv v 3.11.1.1, Copyright (c) Igor Nys, 2000-2005. Usage: pv -[] -[] ...-[] Modes: -s --summary show usage for the specified MODULE -h,-? --help display this help information Actions: -k --kill kill process -a --activate brings process main window in the foreground -c --close close (send WM_CLOSE) to the PROCESS -p[nihr] --priority set priority to "Normal", "Idle", "High", "Real Time" [ba] "Below Normal" and "Above Normal" only on W2K or higher Output Options: -e, --extend show additional information if available -l, --long show command line (can also be a filter) -q, --quiet supress headers and produce a tab-separated list -b --bare show process ID only () Input Options: -f, --force never prompt -i, --id use process ID instead of the PROCESS name Filters: -l[mask] --long include processes with command line matching mask -w[mask] --window show processes with visible windows matching mask, -e includes in search also invisible windows -u[mask] --usage show processes using modules that matches mask -t[root] --tree display process tree starting starting from the root Extra Information Options: -g --getenv get startup environment for the PROCESS -m --module show modules used by specified PROCESS Execution Options: -d[time] --delay delay time in milliseconds before executing command -r[err] --repeat repeat command in a cycle, while (%ERRORLEVEL% > err) -n --number %ERRORLEVEL% = negated number of matched processes -x[a] --exit wait for the process completion (exit) 'a' flag waits for all processes, -d sets time-out -@[file_name] read arguments from specified file or from standard input after processing the command line Arguments can contain '*' and '?' wildcards. Use return code (%ERRORLEVEL%) in batch files: 0 - process found (negated number of processes if -n is specified) 1 - empty result set, 2 - programm error Examples: pv myprocess.exe get process ID for myprocess.exe. pv -e get extended list of running processes. pv -k sleep* kill all processes starting with "sleep" pv -m -e explorer.exe get extended information about explorer's modules pv -u oleaut*.dll list of all processes that use matching dll pv -ph w*.exe set priority to hight for all matching processes pv explorer.exe -l"*/S" looks for explorer process with /S switch pv -r0 -d2000 calc.exe "2>nul" checks every 2 seconds if calc.exe is running Would like to add an example? Found any errors? Please write at support@prcview.com or contact me directly at igornys@writeme.com ------------------------------------------------- LIABILITY DISCLAIMER -- READ BEFORE using pv.exe THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED, IMPLIED OR OTHERWISE, INCLUDING AND WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR OR HIS COMPANY BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, LOSS OF INFORMATION, OR ANY OTHER LOSS) , WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR INABILITY TO USE THIS SOFTWARE.