2Printer is a print workflow automation solution working via command line interface. Whether you use Command Prompt, PowerShell, or a scripting language interpreter, 2Printer operates in the same way.
How to start batch printing quickly
-
Open the Windows Command Prompt. Start the Run application by pressing Win + R combination on your keyboard, and type in "cmd.exe" and press Enter:
Command Prompt can be used to execute entered commands. You can use another command-line interpreter that's comfortable for you.
- Add switches and parameters to the command. In general, the basic syntax is as follows:
2printer.exe -src "C:\In\*.*" -prn "Xerox 2050"
- -src stands for a source for files. It can be a path to a folder, to a file, or a list (a .txt with file paths). For example: -src "C:\In\*.*";
- *.* stands for any filename – point – any file extension. It should be added after the folder path so that 2Printer can take any files from there. Asterisk (star, *) is a wildcard character which stands for any string of characters (or no characters at all);
- -prn should be followed by a printer's name. For example: -prn "Xerox 2050".
When setting the source folder path (or source file path) and printer name – enclose them in double quotation marks. Example: -src "C:\In\Invoice.docx".
- Press Enter to execute the command. All files from the source (-src) will be printed on the selected printer.
Сommand line structure
The basic command line structure consists of switches, parameters, and values. 2Printer command line structure looks like this:
To see a prompt with a list of available features, type in 2Printer.exe and press Enter:
Switches
Use switches to select the source for files, printer, print options, post-processing, and other options. You can enter several parameters (parameter:value) within a single switch, separated by space.
Switch | Description |
---|---|
-src | Source for files. This switch should be followed by the source folder path where files are located, or path to a single file, or path to a list with file destinations. Setting the source for files (-src) is a must. Other switches are optional. You can filter files by mask, e.g., *.docx. To allow processing any files, use *.* If you have a list of files to print, it should be saved as a text file. To set a list of files as a source, use @ before the file path. For example: |
-prn | Printer name. When entering commands, input printer name within double quotation marks. You can check the exact name of a printer in advance. |
-props | Print options. Set up print-related options, such as the number of copies, page range, and more. |
-options | Common options. Define various options, such as scanning subfolders, sorting files, silent printing, and more. |
-postproc | Post-processing action. Copy, move, or delete files automatically after processing, if necessary. Can apply both to successfully printed and failed files. |
-about | Information about the program. Shows license key and software version. |
Command line examples:
Print options (-props)
You can control various print-related parameters using the -props switch.
copies: Set the number of document copies [+][-]
Default value: 1
Example:
duplex: Set duplex mode (double-sided printing) [+][-]
Values:
default (default value), simplex, vertical, horizontal
Double-sided (duplex) printing allows you to print on both sides of paper sheets. If your printer supports duplex printing – this might be a useful feature. By default, 2Printer uses the same duplex mode settings as those defined in your printer preferences. In 2Printer, you can set up vertical or horizontal duplex printing for your documents.
Parameter and value | Effect |
duplex:vertical | Prints documents double-sided using long-edge binding mode. |
duplex:horizontal | Prints documents double-sided using short-edge binding mode. |
You can switch to simplex mode (one-sided printing) by using the duplex:simplex value. Or set duplex:default – to use printer preferences.
Example:
color: Select color or grayscale mode [+][-]
Values:
asinprinter (default value), color, grayscale
Prints all documents in grayscale or color mode.
Examples:
orient: Set page orientation [+][-]
Values:
portrait, landscape, asindocument (default value), asinprinter
The default page orientation value is as set in the document. To print all documents in portrait or landscape orientation, use these commands:
Portrait orientation:
Landscape orientation:
Here you can also select other options:
- orient:asindocument – use the original document's page orientation;
- orient:asinprinter – use the same settings for orientation as in printer.
revpo: Select page order [+][-]
Values:
direct (default value), reverse
You can change the pages' printing order to reverse when printing multipage documents.
Example:
papersize: Select paper size by ID number [+][-]
Default value: -1 (as in printer preferences)
Sets a specific paper size format. Paper size value by default is "-1" (as set in your printer preferences). Use this command to check the ID number of a certain paper size:
pages: Set page range [+][-]
Default value: all
Defines numbers of pages to be printed.
Example:
scale: Select page scaling mode [+][-]
Values:
shrink (default value), fit, asis, fill
Example:
tray: Select printer tray [+][-]
Default value: as set in printer preferences
Enter tray name or ID to use a specific printer tray. You can view a list of available trays in advance.
Example:
attachments: Set the processing of file attachments [+][-]
Values:
ignore, after (default value), before, only
If you print documents that contain attachments, you can select a way how 2Printer should handle them:
- ignore – ignore attachments
- after – print attachment after a document
- before – print attachment before a document
- only – print attachments only
This can be useful when batch printing, e.g., correspondence with email attachments, PDF Portfolio files, and other files with attachments.
Example:
spjob: Enable single print job mode [+][-]
Values:
no (default value), yes
To ensure that files are printed out in order, use the single print job mode. As a result, the files will be printed as a solid batch, in 100% correct order. Files will be sent to a printer as they go in your list (from top to bottom):
Printing in this mode allows you to print in a strictly defined order. Printouts won't get mixed by spooler or other print jobs coming to the same printer from other users.
spjob_name: Enter a filename for the single print job [+][-]
Default value: "2Printer's solid print job"
You can define single print job's name:
The name appears in the print queue (spooler) on the computer and on the printer display. It may be convenient to see what's printing. And it's easy to identify which job is having issues in case of an error.
Besides, if you're printing to a virtual printer, the name of the output file(s) usually matches the print job's name.
hor_align: Set horizontal alignment: left, center, right [+][-]
Values:
left, center (default value), right
Aligns the prints' position in the center, or left/right side of a sheet. Can be combined with other alignment and offset parameters.
Example:
ver_align: Set vertical alignment: top, center, bottom [+][-]
Values:
top, center (default value), bottom
Aligns the prints' position vertically in the top, center, or bottom of a sheet. Can be combined with other alignment and offset parameters.
Example:
hor_offset: Set horizontal offset [+][-]
Default value: 0
Shifts the prints' position horizontally by setting a specific value, in points (1/100 inch). Can be combined with other alignment and offset parameters.
Example:
ver_offset: Set vertical offset [+][-]
Default value: 0
Shifts the prints' position vertically by setting a specific value, in points (1/100 inch). Can be combined with other alignment and offset parameters.
Example:
Command line examples:
Common options (-options)
Scanning subfolders, silent printing, printing without alerts, and other options are controlled by the -options switch.
scansf: Scan subfolders [+][-]
Values (value in bold is default):
no, yes
Scans subdirectories and print files from them too (subfolder recursion).
Example:
srcpwd: Enter source file password(s) [+][-]
Allows printing of password-protected Word and PDF files. Enter a password in this format: srcpwd:password.
If a password contains spaces, input it between double quotation marks.
Example: srcpwd:"my password".
If you have files secured with more than one password, you can enter multiple passwords too.
Example: srcpwd:password1 srcpwd:password2 srcpwd:password3.
Example:
break_on_error: Break on error [+][-]
Values (value in bold is default):
no, yes
Stops the program in case of an error.
Example:
unprinted_files_log: Create a log of files that failed to print [+][-]
You can keep a log of files that failed to print for some reason. You'll need to use -options unprinted_files_log and set a path to a file that should be created for the log file. Just specify a destination to a text file.
Example:
sort: Sort files by a specific parameter [+][-]
Values (value in bold is default):
unsorted, name, date, type, size, path, name_d, date_d, type_d, size_d, path_d
You can sort files by specific parameters, such as name, date, type, size, path. To sort the files in descending order, use values ending with _d (name_d, date_d, etc.).
showprnlist Show a list of printers [+][-]
Displays a list of all available printers and their names. When using other commands, input a printer's name exactly as you see in this list, within double quotation marks.
Execute command:
showtraylist Show a list of printer trays [+][-]
Displays a list of available printer trays. Can show trays of all devices or a selected printer only. When printing, you can use the ID number or name of a specific tray.
To view all printers' names and trays sublist for each printer:
To view trays of a specific printer only, add the printer's name to the command:
For instance, here's a command to print on a Multi-purpose Tray of a Canon printer (as on the screenshot above):
showpapersizelist Show a list of paper sizes [+][-]
Displays a list of all available paper sizes. To view paper sizes of a certain printer only, add -prn and the printer's name to the command:
For example, the following command prints all documents in a folder "C:\In" in Legal paper size format:
silent: Suppress console output [+][-]
Values (value in bold is default):
no, yes
Print all documents in fully automatic mode in silent mode. The information on console window will not be displayed during processing and no dialog windows will appear:
alerts: Display alert windows in case of an error or issue [+][-]
Values (value in bold is default):
no, yes
Command line examples:
Post-print action (-postproc)
Use the -postproc switch to control what should be done with the files after processing: do nothing, move, copy, or delete. By default, there is no post-processing action selected for original files; therefore, all your files remain where they were before printing. If you want to move them somewhere, you can do it as you like.
passed: Select action for successfully printed files [+][-]
Values (value in bold is default):
none, copy, move, delete
Selects action to be performed with successfully printed files: do nothing, copy/move to another folder, or delete.
Example:
passed_dir: Set path to destination folder for copy/move action [+][-]
Specifies a folder where successfully printed files should be moved or copied.
Example:
failed: Select action for files that failed to print [+][-]
Values (value in bold is default):
none, copy, move, delete
Selects action to be performed with files that were not printed: do nothing, copy/move to another folder, or delete.
Example:
failed_dir: Select action for files that failed to print [+][-]
Values (value in bold is default):
none, copy, move, delete
Specifies a folder where failed files should be moved or copied.
Example:
Command line example:
2Printer Settings
Some advanced settings are available in the 2Printer Settings panel with GUI controls. With it, you can modify default settings of the program. To access it, execute this command:
See how to configure 2Printer Settings
The use of command lines makes 2Printer very adaptive to your printing needs. You can combine or modify the command line switches, parameters, and values mentioned above the way you wish – they don’t require strict order. If you have any difficulty setting up your workflows with 2Printer, please let us assist you!