.
Version 0.523, Copyright (C)2002, Frank P. Westlake. The only way to the Father is through Jesus.
Runs a process.
RunProcess [options] ProgramName [ProgramName's parameters]
OPTIONS (':' is optional):
/a:file The contents of this file will be appended to the command line,
following a space (unless '/-a'), and line endings will be
converted to spaces. The length of the resulting command line is
limited by the system to 32kb.
/c:l|n|h|r Set the priority class to low (l), normal (n), high (h), or
realtime (r). Realtime priority should not be used. Ex: /c:n
/desktop:[] Desktop or window station and desktop (default=WinSta0\Default).
/d:DirName Current directory for the process is 'DirName'.
/f:flags Process flags, for experts only. 'flags' may be one or more of
the following (ex: /f:cgp):
c Create a new console window. Cannot be used with 'd'.
d Create a detached process. Cannot be used with 'c'.
g Create a new process group.
p Create the 16-bit application in a private VDM.
s Create the 16-bit application in the shared VDM.
u Create a Unicode environment.
w Create suspended process (if /fGW, CTRL-C resumes).
b If logon as user ('/u'), perform a batch logon.
i If logon as user ('/u'), perform an interactive logon.
n If logon as user ('/u'), perform a network logon.
v If logon as user ('/u'), perform a service logon.
/e:o|n Send the process's STDERR to STDOUT (/e:o) or NULL (/e:n).
/o:e|n Send the process's STDOUT to STDERR (/o:e) or NULL (/o:n).
/i Ignore CTRL_LOGOFF_EVENT for use with SRVANY as a service.
/k:time Kill the process if it does not finish in the specified time. If
not specified otherwise, the time will be read as milliseconds.
To indicate hours, minutes, or seconds, immediately follow the
time with one of the modifiers: h, m, or s. Ex: /k:3000 or /k:3s
/m[:BitMask] Process affinity mask. Ex: /m:1 (1), /m:11 (1,2), /m:10 (2).
/r[:o|e|c|n] Print a process report to STDOUT (o), STDERR (e), or directly to
the console window (c). The default is STDERR. Ex: /r or /r:o
or /r:n to disable all reporting. Any other string is a filename.
/u:username If specified, the process will be logged on with the indicated
username. The username may be preceded with the domain name. Ex:
/u:fwestlake or "/u:NT Authority\system" or /u:.\fwestlake
/p[password] A plain text password that is necessary for username. If absent,
no password is used. If '/p' alone, password is read from STDIN.
/t:time A time, date-time, period, or date-time interval (ISO8601:2000).
Format: [R[n]/][start-date]Tstart-time[/[end-date][Tend-time]]
Ex: /t:T23:36, /t:2002-09-11T23:36, /t:R3/T23:36/T23:45, /t:PT3S
/title:text A console window title.
/v:file Environment block for the process. One line per variable, lines
must be sorted. Leading spaces will not be removed. Format:
Variable Name=Variable value
/w:flags Sets window options. 'flags' may be one or more of the following
followed by a value and separated by commas (Ex: /w:R80,L25):
x Window position, pixels from left of screen.
y Window position, pixels from top of screen.
c Window size, pixels from left to right.
r Window size, pixels from top to bottom.
l Consoles only, buffer size in characters from left to right.
w Consoles only, buffer size in lines from top to bottom.
b Consoles only, background color.
f Consoles only, foreground color.
s Window state (0=hidden, 1=normal, 2=min, 3=max)
/x Do not wait for process to complete before repeating or exiting.
NOTES:
- If the file name extension is not specified, a search will be conducted using
the PATHEXT environment variable.
- For extended command line lengths (/a) do not use CMD.EXE.
- '/k' limits the duration of each occurance of ProgramName, '/t' with an end
time or duration ends all repetitions of ProgramName.
- if '/f:u' and '/v:file' are both specified, 'file' must be a Unicode file.
- The 'ErrorMessage:' item in the report is only useful if the process is using
Windows System Exit Codes. Some programs do, but not always.
EXAMPLES:
Run a process and wait for it to complete:
RunProcess ProgramName
Run a low priority process, wait for it to complete or kill it in 5 seconds,
and print a report to the console instead of STDERR:
RunProcess /c:l /k:5s /r:c ProgramName
Run a process as another user and wait for it to complete:
RunProcess /u:accounting\ksmith /p:secret ProgramName
Repeat a process indefinately from 12:00 to 13:00, kill each instance that
lasts longer than 2 minutes and kill the last instance at 13:00:
RunProcess /t:R/T1200/T1300 /k:2m ProgramName
Run a process on the default desktop and do not wait for it to complete:
RunProcess /x /f:c /desktop ProgramName