2Printer Command Line Syntax

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

  1. 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:

    Run Command Prompt (CMD, command-line interpreter)

    Command Prompt can be used to execute entered commands. You can use another command-line interpreter that's comfortable for you.

  2. 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".

  3. 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:

2Printer -<switch1> [param1:value paramN:value] -<switchN> [parameters]

To see a prompt with a list of available features, type in 2Printer.exe and press Enter:

2printer.exe

Display help information for 2Printer

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:
-src "@C:\Files\list.txt" 

You can use multiple sources at once. Enter them after -src one after another within double quotation marks and separated by space.
-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:

2printer.exe -src "C:\In\*.*" -prn "Xerox 2050"

2printer.exe -src "C:\In\File.docx" -prn "Xerox 2050"

2printer.exe -src "C:\In\*.*" -prn "Xerox 2050" -props copies:5 color:grayscale

2printer.exe -src "@C:\Files\list.txt" -prn "Xerox 2050" -options silent:yes -props spjob:yes

2printer.exe -src "C:\In\*.*" -prn "Xerox 2050" -postproc passed:move passed_dir:"C:\Done"

2printer.exe -about

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:

2printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props copies:3

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:

2Printer.exe -s "C:\In\*.*" -prn "MFP LaserJet" -props duplex:vertical

color: Select color or grayscale mode

Values:

asinprinter (default value), color, grayscale

Prints all documents in grayscale or color mode.

Examples:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props color:grayscale

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props color:color

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:

2Printer.exe -s "C:\Input\*.*" -prn "MFP LaserJet" -props orient:portrait

Landscape orientation:

2Printer.exe -s "C:\Input\*.*" -prn "MFP LaserJet" -props orient:landscape

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:

2printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props revpo:reverse

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props papersize:5

pages: Set page range

Default value: all

Defines numbers of pages to be printed.

Example:

2printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props pages:1,3,5-12

scale: Select page scaling mode

Values:

shrink (default value), fit, asis, fill

Example:

2printer.exe -src "C:\In\Document.pdf" -prn "MFP LaserJet" -props scale:fill

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props tray:4

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props attachments:before

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):

2Printer.exe -src "@C:\Input\docs.txt" -prn "MFP LaserJet" -props spjob:yes

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: 

2Printer.exe -src "@C:\Input\docs.txt" -prn "MFP LaserJet" -props spjob:yes spjob_name:"Docs for visa"

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props hor_align:left

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props ver_align:top

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props hor_offset:150

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:

2Printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props ver_offset:-50

Command line examples:

2printer.exe -src "C:\In\*.*" -prn "MFP LaserJet" -props copies:3 duplex:vertical orient:portrait

2printer.exe -src "@E:\list.txt" -prn "MFP LaserJet" -props spjob:yes spjob_name:"My docs"

2printer.exe -src "C:\In\Document.pdf" -prn "MFP LaserJet" -props tray:"258" pages:"1-3" color:grayscale

ASK US FOR HELP

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:

2Printer.exe -src "C:\In\*.*" -prn "iR C3025" -options scansf:yes

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:

2printer.exe -src "C:\In\*.*" -prn "iR C3025" -options srcpwd:"my password"

break_on_error: Break on error

Values (value in bold is default):
no, yes

Stops the program in case of an error.

Example:

2printer.exe -src "C:\In\*.*" -prn "iR C3025" -options break_on_error:yes

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:

2printer.exe -src "C:\In\*.*" -prn "iR C3025" -options unprinted_files_log:"C:\Logs\failed.txt"

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:

2Printer.exe -options showprnlist

See full list of available printers

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: 

2Printer.exe -options showtraylist

To view trays of a specific printer only, add the printer's name to the command:

2Printer.exe -prn "iR C3025" -options showtraylist

Show a list of printers and their trays

For instance, here's a command to print on a Multi-purpose Tray of a Canon printer (as on the screenshot above):

2Printer.exe -src "C:\In\*.*" -prn "Canon iR C3000 Series UFR II" -props tray:4

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:

2Printer.exe -prn "Canon iR C3000 Series UFR II" -options showpapersizelist

Show available paper size formats

For example, the following command prints all documents in a folder "C:\In" in Legal paper size format:

2Printer.exe -src "C:\In\*.*" -prn "Canon iR C3000 Series UFR II" -props papersize:5

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:

2Printer.exe -src "C:\In\*.*" -prn "iR C3025" -options silent:yes

alerts: Display alert windows in case of an error or issue

Values (value in bold is default):
no, yes

Displays alert windows in case of an error or issue. If set to "no", you will not get any dialog windows, such as asking to register the program's license or to print an additional cover page (if the free version is used). However, the information on console window will be displayed during processing:

2Printer.exe -src "C:\Input\*.*" -prn "iR C3025" -options alerts:no

Command line examples:

2printer.exe -src "C:\In\*.*" -prn "iR C3025" -options srcpwd:"my password"

2printer.exe -src "C:\In\*.*" -prn "iR C3025" -options scansf:yes sort:type

2printer.exe -src "C:\In\*.*" -prn "iR C3025" -options silent:yes alerts:no

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. 

Move, copy, or delete printed (or not printed) files with post-print action 

Example:

2printer.exe -src "C:\In\*.*" -prn "HP LaserJet 5L" -postproc passed:delete

passed_dir: Set path to destination folder for copy/move action

Specifies a folder where successfully printed files should be moved or copied. 

Example:

2printer.exe -src "C:\In\*.*" -prn "HP LaserJet 5L" -postproc passed:copy passed_dir:"C:\Printed"

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:

2printer.exe -src "C:\In\*.*" -prn "HP LaserJet 5L" -postproc failed:delete

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:

2printer.exe -src "C:\In\*.*" -prn "HP LaserJet 5L" -postproc failed:move failed_dir:"C:\Failed"

Command line example:

2printer.exe -src "C:\In\*.*" -prn "HP LaserJet 5L" -postproc passed:delete -postproc failed:move failed_dir:"C:\Failed"

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:

2printer.exe -ini

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!

CONTACT US