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
See also JOBMONITOR and START.
Usage:
A 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:
/J=nameSet or display options for an existing job.
/PM=n | Limit 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. |
/PT=ms | Limit 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. |
/S | Prevent processes associated with the job from changing system parameters using the SystemParametersInfo API. |
/U | Prevent processes associated with the job from using USER handles owned by processes not associated with the same job. |
/X | Prevent processes associated with the job from logging out of Windows, rebooting, or shutting down. |
/Y | Allow any process associated with the job to create child processes that are not associated with the job. |
/Z | Disables 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. |