2Printer command line syntax and examples

2Printer allows you to fully automate your printing tasks. Let’s see how it works and review its basic features.

Using the Command Line

First, open the Windows Command Prompt (command line). Start the Run application, press Win + R combination on your keyboard, type in "cmd" and press Enter:

Run Command Prompt

Command Prompt is used to execute entered commands. Most of those commands are used to automate tasks via scripts and batch files, perform advanced administrative functions and solve certain kinds of Windows issues.

Basic information

Reference

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

2Printer.exe -help

Display help information

Show printers list

See full list of available printers. When entering other commands, use the printer names exactly like you see in this list:

2Printer.exe -getprnlist

See full list of available printers

Print all documents in a folder "C:\Input" on printer "HP Color LaserJet Pro MFP M176n":

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n"

Show tray list

See printers list and trays sublist for each printer. Use a certain tray ID number if necessary:

2Printer.exe -showtraylist

Show a list of printers and their trays

Print all documents in a folder "C:\Input" on a "Tray 1". Select printer tray by its ID number:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -tray "258"

Define folder and subfolders

Select folder

Print all documents in a folder "C:\Input" on default Windows system printer with default settings:

2Printer.exe -s "C:\Input\*.*"

Select folder with subfolders

Print all PDF files in a folder "C:\Input" and all subfolders on default Windows system printer with default settings:

2Printer.exe -s "C:\Input\*.pdf" -r

Print settings

Paper size

See a list with available paper size formats. Paper size value by default is "-1" (is defined by your printer settings). Use paper format ID if necessary:

2Printer.exe -showpapersizelist

Show available paper size formats

The following command will print all documents in a folder "C:\Input" in A4 paper size format:

2Printer.exe -s "C:\Input\*.*" -prn "Fax" -papersize 9

Color mode

Print all documents in a folder "C:\Input" in grayscale or color mode:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -color no

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -color yes

Duplex & simplex mode

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 for you. In 2Printer you can set up vertical or horizontal duplex printing for your documents. Switch back to simplex mode (one-sided printing) by using the "-duplex none" value. Print in all documents in a folder "C:\Input" in various duplex modes:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -duplex none

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -duplex vertical

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -duplex horizontal

Define copies

Print 3 copies of all documents in a folder "C:\Input". Number of copies by default is 1:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -copies 3

Define page range

Print all documents in a folder "C:\Input" with defined page ranges. Default "page range" value is "all":

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -range "1,3,12-15"

Define page orientation

Print all documents in a folder "C:\Input" in portrait or landscape orientation. Deafult "page orientation" value is "-1" (is defined by your printer settings):

Portrait orientation:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -orient 1

Landscape orientation:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -orient 2

Set advanced print settings

Open 2Printer Ini File Editor:

2Printer.exe -ini

2Printer Ini File Editor

Miscellaneous

Delete original input files after printing

Delete all documents in a folder "C:\Input" after they have been printed out. Use -delsrc attribute:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -delsrc

See log path

Print all documents in a folder "C:\Input" with additional logging of information on console window:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -verbose

Set silent mode

Print all documents in a folder "C:\Input" in silent mode (information on console window will not be displayed during processing and no dialog windows will appear):

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -silent

Set "no alerts" mode

Print all documents in fully automatic mode without interruption. You will not get any dialog windows, such as asking to register program licence or to print an additional cover page (if free version is used). However, the information on console window will be displayed during processing:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -alerts_no

Get report on completion

Print an advanced report file after the documents are printed:

2Printer.exe -s "C:\Input\*.*" -prn "HP Color LaserJet Pro MFP M176n" -pres

Cases & Solutions

Print all files in a folder

To print all documents in a folder "C:\Input" use the "*.*" mask. It will print any supported file types in the folder:

2Printer.exe -s "C:\Input\*.*"

Print files by file extension

To print only files of a certain extension, use the ".[file extension]" mask. For example:

2Printer.exe -s "C:\Input\*.doc*"

2Printer.exe -s "C:\Input\*.pdf*"

2Printer.exe -s "C:\Input\*.xls*"

Batch print files

Print all documents listed in a text file. The "docs.txt" in the example below should be saved as a Unicode or ANSI text file with a list of paths to files. Each file path should start from a new line:

2Printer.exe -l "C:\Input\docs.txt" -prn "HP Color LaserJet Pro MFP M176n"

Plain text file containing file paths

Batch print files in a certain order

Print documents in a specific order within a single print job. The files will be printed in sequence (from the top to the bottom) as they are your text file. The text file should contain full file paths to the documents starting from a new line:

2Printer.exe -l "C:\Input\docs.txt" -prn "HP Color LaserJet Pro MFP M176n" -singlejob

Print files on a virtual printer

Print all documents in a folder "C:\Input" to PDF or image format on a virtual printer (for example, Universal Document Converter):

2Printer.exe -s "C:\Input\*.*" -prn "Universal Document Converter"

The use of command lines makes 2Printer very adaptive to your printing needs. You can combine or modify the command line arguments and variables mentioned above the way you wish - they don’t require strict order. If you have any difficulty setting up your workflows via 2Printer, please let us help you!