PRNJOBS - CMD
Overview
The PRNJOBS
command in Windows CMD is used to manage print jobs on a local or network printer. Its primary function is to pause, resume or cancel print jobs, making it useful in environments where print job management is frequently needed, such as offices or educational institutions.
Syntax
The PRNJOBS
command follows this basic syntax:
PRNJOBS [-z [\\ServerName] -p PrinterName [-j JobID] [-x | -r | -c]]
Parameters:
-z
: Specifies the target server; use\\ServerName
for network printers or omit for local printers.-p PrinterName
: Specifies the printer by its name (required).-j JobID
: Specifies the job ID to be managed. If omitted, the command applies to all jobs on the specified printer.-x
: Pauses the specified print job.-r
: Resumes the specified print job.-c
: Cancels the specified print job.
Options/Flags
- -x: Pauses the print job. Useful when you need to temporarily halt printing without canceling the job.
- -r: Resumes a paused print job. Use this to continue printing after an interruption.
- -c: Cancels a print job. This is helpful when an error occurs, or the job is no longer needed.
Examples
-
Pausing a Print Job:
PRNJOBS -z \\OFFICE-PC -p HPDeskJet22 -j 123 -x
This command pauses job ID 123 on the HPDeskJet22 printer connected to the OFFICE-PC.
-
Resuming a Print Job:
PRNJOBS -p CanonIR2000 -j 124 -r
Resumes the print job with ID 124 on the locally connected CanonIR2000 printer.
-
Canceling All Jobs on a Printer:
PRNJOBS -p EpsonL3210 -c
Cancels all print jobs queued on the EpsonL3210 printer.
Common Issues
- Permission Errors: Ensure you have administrative privileges to manage print jobs, especially on a network.
- Invalid Printer or Job ID: Always double-check the printer name and job ID. Incorrect entries will prevent the command from executing properly.
Integration
The PRNJOBS
command can be integrated with batch scripts for automated management of print jobs. Here’s an example of a script that checks for stalled print jobs and restarts them:
@echo off
for /f "tokens=3" %%a in ('PRNJOBS -p PrinterName -l') do (
PRNJOBS -p PrinterName -j %%a -r
)
This script assumes there is a method to list jobs with status where -l
would hypothetically list current jobs.
Related Commands
- PRINT: Manages print jobs from the command line.
- NET USE: Connects or disconnects from a network resource and can be used to map a network printer.
- RUNDLL32 PRINTUI.DLL,PrintUIEntry: More advanced printer management.
For further reading, refer to the Microsoft documentation on Print Management Commands.