Print - DOS/Command Prompt Reference
[MS-DOS and Windows NT series/XP or later] Sends text data to the printer.
Syntax
print[.exe] [/D:<device>] [/B:<size>] [/U:<num>] [/M:<num>] [/S:<num>] [/Q:<size>] [/T] [<file-name> ...] [/C] [/P]
Options
<file-name> | Specifies the file name(s) to print. Multiple names can be specified, and wildcards can also be used. |
/D:<device> |
Specifies the device to use for printing. Normally, <device> would be set to PRN, LPT1-LPT3, or COM1-COM4. [MS-DOS only] This option can only be specified when launching Print for the first time. [Windows NT series/XP or later] If a file name is specified for <device>, the data sent during printing will be written to that file. However, you cannot specify an existing file name. |
/B:<size> | [MS-DOS only] Specifies the size of the printer buffer (the buffer before transferring to the printer). <size> should be a value between 512 and 16384 (in bytes). If not specified, the default size ‘512’ will be used. |
/U:<num> | [MS-DOS only] Specifies the clock time (where 18 is approximately equivalent to 1 second) to wait until the printer becomes available. If the printer does not become available within the specified time, printing will not start. <num> can be a value between 1 and 255, and the default is ‘1’. |
/M:<num> | [MS-DOS only] Specifies the maximum clock time required for the printer to print one character. If the printing speed is slow, an error message will be displayed. <num> can be a value between 1 and 255, and the default is ‘2’. |
/S:<num> | [MS-DOS only] Specifies the clock time consumed when the Print program prints in the background during scheduling. A larger value will result in improved printing speed at the expense of decreased execution speed for concurrent programs. <num> can be a value between 1 and 255, and the default is ‘8’. |
/Q:<size> | [MS-DOS only] Specifies the maximum number of files that can be placed in the print queue. <size> can be a value between 4 and 32, and if not specified, the default ‘10’ will be used. |
/T | [MS-DOS only] Deletes all files from the print queue and terminates the printing process. |
/C | [MS-DOS only] Deletes the specified file from the print queue. The file specified on the command line just before ‘/C’ and the files specified between ‘/C’ and ‘/P’ (or the end if ‘/P’ is not present) will be removed from the queue. (However, the file just before ‘/P’ will be subject to the effect of ‘/P’ if present.) |
/P | [MS-DOS only] Adds the specified file to the print queue. The file specified just before ‘/P’ on the command line and the files specified between ‘/P’ and ‘/C’ (or the end if ‘/C’ is not present) will be added to the queue. (However, the file just before ‘/C’ will be subject to the effect of ‘/C’ if present.) |
Details
‘Print’ is used to print text files from the command line. However, since many applications have their own ‘print’ commands, it is usually preferable to use those. Printing with the Print program involves sending the specified text data directly to the printer, known as ‘RAW printing’, so the printer must be able to interpret the text data.
When printing text data, Print appends the character with the character code ‘0x0C’ (Ctrl+L, Form Feed) at the end of the output.
* You can take advantage of the ‘text data is sent directly to the printer’ feature by including special text commands in the text file that your printer can interpret. For example, if the specified device interprets PostScript, you can describe the text data in PostScript to achieve the corresponding printing result.
You can use the ‘net use’ command to assign a network-shared printer to LPT1 to LPT3 (and possibly LPT4 and beyond in some cases). By assigning the printer to a device file with this command, you can use the printer as the destination for printing with the Print command.
Additionally, while you can use output redirection with device files like PRN to send data directly to a printer, output redirection synchronously sends data, whereas Print processes print jobs in the background, allowing printing without blocking other tasks or operations.
* The Print command itself does not use standard input as its input source, so you cannot use redirection or pipes to send data to Print.
[MS-DOS only] Print resides in memory as a background process when initially launched. It uses the device specified with the ‘/D’ option as the output destination for printing. If the ‘/D’ option is not specified, it prompts for the device to use. Subsequent executions of Print, starting from the second time, cannot use the ‘/D’, ‘/B’, ‘/U’, ‘/M’, ‘/S’, and ‘/Q’ switches because Print is already resident. To modify the device or settings specified by these switches, you need to restart the system.
[MS-DOS only] When printing a text file, Print outputs tab characters in the text data as eight spaces. If it encounters the character with the code ‘0x1A’ (Ctrl+Z, often used as an EOF character), it terminates the reading process considering that character as the end symbol. The maximum character count for files placed in the print queue is 64 characters.
[Windows NT series?/XP or later] Print outputs tab characters and the character with the code ‘0x1A’ without any specific interpretation. Therefore, the Print program is simply a program that adds a Form Feed to the end and sends the contents of the file to the device (file).
Samples
Sample 1
print /D:COM1
[MS-DOS only] Sets the current system's printer device to ‘COM1’.
Sample 2
print myData.ps
Print the text data contained in the file ‘myData.ps’ (In the MS-DOS version, the file will be added to the print queue). Since the output device is not specified, in the MS-DOS version, if Print is already resident, it will use the device specified at that time. If it's not yet resident, a prompt will be displayed to ask for the output destination. In the Windows version, it will be sent to ‘PRN’.