Delen via


Prnjobs.vbs

Pauses, resumes, cancels, and lists print jobs. Used without parameters, prnjobs.vbs displays command-line help for the prnjobs.vbs command.

To pause a print job

Syntax

cscript prnjobs -z [-s RemoteComputer-p PrinterName -j JobNumber [-u UserName -w Password]

Parameters

-z   : Required. Specifies that you want to pause a print job.

-s   RemoteComputer   : Specifies, by name, the remote computer to which the print job you want to pause was sent. If you do not specify a computer, the local computer is used.

-p   PrinterName   : Required. Specifies, by name, the printer that would print the job you want to pause.

-j   JobNumber   : Required. Specifies, by ID number, the print job you want to pause.

-u   UserName   -w Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer to which the print job you want to pause was sent. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • To display a list of print jobs and their ID numbers, use this command with the -l parameter.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Example

To pause a print job with a job ID of 27 sent to the remote computer named HRServer for printing on the printer named ColorPrinter, type:

cscript prnjobs.vbs -z -s HRServer -p ColorPrinter -j 27

To resume a print job

Syntax

cscript prnjobs -m [-s RemoteComputer-p PrinterName -j JobNumber [-u UserName -w Password]

Parameters

-m   : Required. Specifies that you want to resume a print job.

-s   RemoteComputer   : Specifies, by name, the remote computer to which the print job you want to resume was sent. If you do not specify a computer, the local computer is used.

-p   PrinterName   : Required. Specifies, by name, the printer that will print the job you want to resume.

-j   JobNumber   : Required. Specifies, by ID number, the print job you want to resume.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer to which the print job you want to resume was sent. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • To display a list of print jobs and their ID numbers, use this command with the -l parameter.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

To cancel a print job

Syntax

cscript prnjobs -x [-s RemoteComputer-p PrinterName -j JobNumber [-u UserName -w Password]

Parameters

-x   : Required. Specifies that you want to cancel a print job.

-s   RemoteComputer   : Specifies, by name, the remote computer to which the job you want to cancel was sent. If you do not specify a computer, the local computer is used.

-p   PrinterName   : Required. Specifies, by name, the printer that would print the job that you want to cancel.

-j   JobNumber   : Required. Specifies, by ID number, the print job you want to cancel.

-u   UserName   -w   Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer to which the print job you want to cancel was sent. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • To display a list of print jobs and their ID numbers, use this command with the -l parameter.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

To list the print jobs in a print queue

Syntax

cscript prnjobs -l [-s RemoteComputer] [-p PrinterName] [-u UserName -w Password]

Parameters

-l   : Required. Specifies that you want to list all the print jobs in a print queue.

-s   RemoteComputer   : Specifies, by name, the remote computer that hosts the print queue whose jobs you want to list. If you do not specify a computer, the local computer is used.

-p   PrinterName   : Specifies, by name, the printer whose print queue contains the jobs you want to list. If you do not specify a printer, then all jobs in all print queues are listed.

-u   UserName   -w Password   : Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer that hosts the print queue whose jobs you want to list. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.

/? : Displays help at the command prompt.

Remarks

  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.

  • To display a list of print jobs and their ID numbers, use this command with the -l parameter.

  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Example

To list all current print jobs in the queue for the local printer named ColorPrinter_2, type:

cscript prnjobs.vbs -l -p ColorPrinter_2

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Prncnfg.vbs

Prnjobs.vbs

Prnmngr.vbs

Prnport.vbs

Prnqctl.vbs

Command-line reference A-Z

WMI overview

WMI overview