Purpose:Create Windows Jobs and optionally attach processes to a job

 

Format:JOBS [/= /J=jobname /N=jobname /B /C /D /G /K /R /S /U /W /X /Y /JM=mem /PM=mem /P=n /JT=ms /PT=ms] [pid | processname]

 

pid - Process ID of a process to assign to the job

 

processname - Process name of a process to assign to the job

 

/B(reakaway)/R(ead clipboard)
/C(lose)/S (SystemParametersInfo)
/D(esktops)/U(ser handles)
/G(lobal atoms)/W(rite clipboard)
/I(nfo)/X (no logout or shutdown)
/K (close on last handle)/Y (allow breakaway)
/L (display settings)/Z (die on unhandled exception)

 

See also JOBMONITOR and START.

 

Usage:

 

job in Windows allows you to control of one or more processes as a group. A job’s basic function is to allow groups of processes to be managed as a unit. You can limit the amount of memory or cpu time for a job, and put restrictions on what processes in that job are allowed to do. A process can be a member of only one job object, and once a process is associated with a job, the association cannot be broken. After a process is associated with a job, by default any child processes it creates are also associated with the job. (See the /B option below for the exception to this rule.)

 

You can start a new job attached to a specific job with the "START /job=jobname" option.

 

You cannot attach a process to a job if that process already belongs to a job.

 

Examples:

 

Start a program, create a job named "NoStop", prevent the program (and any programs it starts) from logging out, rebooting, or shutting down, and terminate all of the processes when the last job handle is closed:

 

start /pgm myapp.exe

jobs /N=NoStop /X /K %_startpid

 

Option:

 

/=Display the JOBS command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/J=nameSet or display options for an existing job

 

/N=nameCreate a new job.

 

/JM=nCauses all processes associated with the job to limit the job-wide sum of their committed memory to n bytes. When a process attempts to commit memory that would exceed the job-wide limit, it fails.

 

/PM=nLimit the maximum committed memory for for all processes in the job to n bytes. When a process attempts to commit memory that would exceed the per-process limit, it fails.

 

/P=n Limit the total number of processes in the job to n.

 

/JT=msLimit the maximum amount of per-job user-mode execution time to ms milliseconds.

 

/PT=msLimit the maximum amount of user-mode execution for all processes associated with the job to ms milliseconds

 

/B If any process associated with the job creates a child process using the CREATE_BREAKAWAY_FROM_JOB flag while this limit is in effect, the child process is not associated with the job.

 

/CClose a job handle.

 

/DPrevent processes associated with the job from creating and/or switching to other desktops.

 

/GPrevent processes associated with the job from accessing global atoms.

 

/IDisplay limit info for the job.

 

/KAll processes associated with the job will terminate when the last handle to the job is closed. If you START other processes, you should use the /job option if you want the START'd processes to exit when the original process exits.

 

/LPrevent processes associated with the job from calling the ChangeDisplaySettings API

 

/RPrevent processes associated with the job from reading from the Windows clipboard.

 

/SPrevent processes associated with the job from changing system parameters using the SystemParametersInfo API.

 

/UPrevent processes associated with the job from using USER handles owned by processes not associated with the same job.

 

/WPrevent processes associated with the job from writing to the Windows clipboard.

 

/XPrevent processes associated with the job from logging out of Windows, rebooting, or shutting down.

 

/YAllow any process associated with the job to create child processes that are not associated with the job.

 

/ZDisables the critical error popup dialog for each process associated with the job. If an exception occurs, this will cause termination of the process with the exception code as the exit status.