Run printing commands from the command prompt

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

To run printing commands from the command prompt

  1. Open Command Prompt.

  2. At the command prompt, you can run the following printing-related commands:

    • To print a text file or display the contents of a print queue.

    • To display or control print jobs and printer queues.

    • To connect to, or disconnect from, a shared printer.

    • To start the print spooler service.

    • To stop the print spooler service.

To print a text file or display the contents of a print queue.

For command syntax, see Print.

Example:

To print the text file Autoexec.bat to a printer on parallel port LPT2:

print /d:LPT2: C:\autoexec.bat

To display or control print jobs and printer queues.

For command syntax, see Net print.

Examples:

To view the print queue of MyPrinter1 on print server W2KPRN1:

net print\\W2KPRN1\MyPrinter1

To delete print job number 2 on MyPrinter1 on print server W2KPRN1:

net print \\W2KPRN1 2/delete

To connect to, or disconnect from, a shared printer.

For command syntax, see Net use.

Examples:

To redirect print output for the LPT1 port to MyPrinter1 on print server W2KPRN1:

net use LPT1: \\W2KPRN1\MyPrinter1

To display information about the LPT1 port:

net use LPT1:

To start the print spooler service.

For command syntax, see Net start.

Example:

To start the Print Spooler service:

net startspooler

To stop the print spooler service.

For command syntax, see Net stop.

Example:

To stop the Print Spooler service:

net stopspooler

Note that other dependent services might need to be stopped as well. The system prompts you to confirm, while listing the other service names.

Notes

  • To open a command prompt, click Start, point to All programs, point to Accessories, and then click Command prompt.

  • Command-prompt commands can be useful if you need to connect users to shared printers through a login script or any other automated batch or a script procedure.

Information about functional differences

  • Your server might function differently based on the version and edition of the operating system that is installed, your account permissions, and your menu settings. For more information, see Viewing Help on the Web.