Features
From picking files and setting up the printer to stamping pages, archiving and reporting — every stage, with a sample command for each.
01Inputs and batch sources
-src takes one or more sources, and you can mix them:
- A single file, a folder (same as
folder\*.*) or a wildcard such asD:\Contracts\2026-*.pdf;scansf:yesincludes subfolders. - TXT lists:
@list.txtwith one path or wildcard per line; lines starting with#or;are comments; UTF-8, UTF-16 and ANSI code pages are detected. - Excel/CSV lists:
@list.xlsxor@list.csvwith a#filecolumn and optional#copies,#pagesand#printercolumns that override settings per row. - URLs:
https://…, withuserandpasswordwhen a login is needed. - Standard input:
@-reads the file list from a pipe. - Sorting:
sort:name|date|type|size|path, add_dfor descending; names sort naturally (2 before 10). - Safe scanning:
min_age:120only takes files last written more than 2 minutes ago; files locked by another program are skipped.
cmd4printer -src "D:\Scans\*.pdf" "D:\Scans\*.jpg" -prn "Office A" -options scansf:yes sort:date min_age:120dir /b /s D:\Contracts\*.pdf | cmd4printer -src "@-" -prn "Office A"02Supported formats
99 extensions in total. The table shows what handles each family and what it needs. cmd4printer -about lists the conversion engines available on your PC.
| Family | Extensions | Notes and requirements |
|---|---|---|
Built-in PDFium engine; password-protected files (srcpwd) and embedded attachments | ||
| Common images | jpg jpeg jpe jfif png bmp dib gif tif tiff emf wmf | Built-in; multi-page TIFF prints every page |
| More image formats | webp heic heif avif jxr wdp hdp ico | Uses the Windows imaging codecs; HEIC/AVIF need the matching Windows image extension |
| TGA | tga | Built-in |
| Photoshop | psd psb | Built-in; prints the composite image |
| Text and source code | txt text log ini bat cmd c cpp h java js php ps1 ps1m py vb vbs ics vcf json xml sql cs | Built-in; font and size via -fls txt |
| XPS | xps oxps | Built-in |
| CAD vector drawings | dxf plt hpgl hgl | Built-in, vector output (DWG/DWF are not supported; save as DXF or PDF) |
| Printer-language passthrough | zpl prn pcl epl | Sent to the printer unchanged; the printer must understand the language (e.g. a ZPL label printer) |
| Web pages and URLs | htm html xhtml mht mhtml svg | Requires Microsoft Edge or Google Chrome |
| Markdown | md markdown | Requires Edge or Chrome |
| EPUB e-books | epub | Requires Edge or Chrome |
| eml emlx msg | Requires Edge or Chrome; attachments before/after the message or alone (attachments) | |
| Word documents | doc docx docm dot dotx dotm rtf odt wps | Requires Microsoft Word on the PC |
| Excel workbooks | xls xlsx xlsm xlsb xlt xltx ods csv | Requires Microsoft Excel on the PC |
| PowerPoint presentations | ppt pptx pptm pps ppsx pot potx odp | Requires Microsoft PowerPoint on the PC |
| Visio drawings | vsd vsdx vsdm vdx | Requires Microsoft Visio on the PC |
| Publisher files | pub | Requires Microsoft Publisher on the PC |
.lbl as ZPL passthrough; -engine picks the engine for a format.cmd4printer -src "C:\In\*.html" -prn "Office A" -engine file_format:html name:chrome03Print settings
| You want | Parameter |
|---|---|
| Copies and collation | copies:3 collation:bydocuments |
| Duplex (long/short edge) | duplex:vertical / duplex:horizontal |
| Color, grayscale or detect per page | color:grayscale / color:asindocument |
| Color by page range | color_pages:"1=color;2-last=grayscale" |
| Page range | pages:1,3,5-12 / pages:1,last |
| Paper by name/ID or matched to the page size | papersize:A4 / papersize:-2 |
| Tray, and tray by page range | tray:"Tray 2" / pssp:"1=Tray 1;2-last=Tray 2" |
| Orientation and auto-rotation | orient:landscape / auto_rotation:cw |
| Scaling | scale:fit / scale:zoom zoom_percent:90 |
| Reverse order | revpo:reverse |
| Skip blank pages | skip_empty:yes |
| One print job for all files (strict order) | spjob:yes spjob_name:"…" |
| Split large jobs | split_every:200 / max_copies_per_job:50 |
cmd4printer -src "D:\Contracts\*.pdf" -prn "Office A" -props copies:2 duplex:vertical color:grayscale pages:1-3 papersize:A4 tray:"Tray 2"Tray and paper names depend on the printer — look them up first:
cmd4printer -prn "Office A" -options showtraylist showpapersizelist04Page operations: watermarks, barcodes, rotate, crop
-oper can be repeated, and each operation has its own page range (pages:). Available operations:
| Operation | Purpose |
|---|---|
textwatermark | Text watermark: font, size, color with alpha, angle, background, border; text may contain macros |
watermark | Image watermark: PNG/JPG/BMP/GIF or the first page of a PDF, with opacity and layer |
barcode | 22 symbologies: QR, Data Matrix, PDF417, Code 128, EAN-13, GS1 and more |
rotate | Rotate; multiples of 90° keep PDF pages vector |
crop | Crop by margins, by rectangle or automatically |
resize | Resize to a size, six fit modes |
rasterize | Convert to an image, a fix for problematic files |
Macros for text and barcodes: {SrcFileName}, {SrcFileExt}, {SrcFilePath}, {SrcFilePageNo}, {SrcFilePageCount}, {FileIndex}, {FileCount}, {Date:yyyy-MM-dd}, {Time}, {UserName}, {ComputerName}, {PrinterName}, {env:NAME}.
cmd4printer -src "D:\Drawings\*.pdf" -prn "Office A" -oper textwatermark text:"INTERNAL USE ONLY" fontsize:40 halign:center valign:center angle:45 color:"r:120,g:120,b:120,a:90" bgcolor:"#FFFFFF00" -oper textwatermark text:"Page {SrcFilePageNo} of {SrcFilePageCount}" halign:right valign:bottom fontsize:905N-up and booklets
-multipps places several pages on one sheet: 1–10 across and 1–10 down, with gaps, frames and page order; start_next_doc_on_new_sheet:no lets the next file continue on the same sheet. Booklet mode puts two pages on each side, pads the page count to a multiple of four and switches to short-edge duplex, so the stack folds into reading order; bind on the left, right or top.
cmd4printer -src "D:\Handouts\*.pdf" -prn "Office A" -multipps enabled:yes hor_pages:2 ver_pages:2 draw_frame:yescmd4printer -src "D:\Manual.pdf" -prn "Office A" -multipps enabled:yes booklet:yes booklet_binding:left06Cover and service pages
-spops cover:yes prints a cover sheet before each file, which makes sorting output on a shared printer easy. Use the built-in Blank, Filename, Filename with app logo or FileInfo templates, your own HTML (@cover.html, macros allowed), or drag elements around in the cover designer of the settings window and save a .cover file. folder_cover:yes adds a sheet whenever a new subfolder starts, ending:yes a summary page at the end of the batch. The cover is its own print job by default; same_job:yes joins it to the document.
cmd4printer -src "@D:\Daily\list.txt" -prn "Office A" -props spjob:yes -spops cover:yes template:FileInfo ending:yes
07Post-processing
-postproc handles source files that printed and files that failed separately: copy, move or delete. Rename the target with macros (for example, add the date); conflict decides between rename, overwrite and skip; passed_delsf:yes removes subfolders left empty. A dry run never post-processes anything.
cmd4printer -src "D:\Inbox\*.*" -prn "Office A" -postproc passed:move passed_dir:"D:\Printed" passed_name:"{Date:yyyyMMdd}-{SrcFileName}.{SrcFileExt}" failed:move failed_dir:"D:\Failed"08Logs, statistics and exit codes
log:yes logpath:"…" logverbosity:regular: one XML event log per run.pres:"…": plain-text list of results;unprinted_files_log:"…": failed files, ready to reprint as an@list.-stat report_folder:"…" format:csv: statistics with pages, sheets and color/grayscale page counts.output:jsonorjsonl: results as JSON on standard output for your programs.export_path:"…": logs, settings and system information in a ZIP (passwords masked) for support requests.
| Exit code | Meaning | What to do |
|---|---|---|
0 | All files were submitted to the print queue | — |
1 | Internal error | Export logs with -options export_path and contact support |
2 | Usage error: wrong switch, value or syntax | Read the allowed values and the example in the error message |
3 | Environment problem: printer, tray, paper or files not found, or the print spooler is stopped | Check names with showprnlist / showtraylist |
4 | Some files failed; the others were submitted | Check unprinted_files_log and reprint only those files |
5 | Submit result unknown; the job may already be queued | Check the print queue before reprinting |
6 | Cancelled (Ctrl+C) | — |
cmd4printer -src "D:\Inbox\*.*" -prn "Office A" -options log:yes logpath:"D:\PrintLogs" unprinted_files_log:"D:\PrintLogs\failed.txt" -stat report_folder:"D:\PrintLogs" format:csv09Automation: scheduled tasks, scripts, command files
silent:yes alerts:no: no console output and no pop-ups, ideal for scheduled tasks.dryrun:yes: plan only — nothing is printed or moved.timeout:300: give up on a file after 5 minutes of conversion and printing and move on.runscript:"…" script_params:"{SrcFilePath}": run a script before each file; a non-zero result marks the file as failed.-cmdlines commands.txt: run several commands from a file, one per line — handy for very long commands or several printers.-inipath profile.ini: a different set of defaults for each task.outputfile:"…": with a virtual printer, write the output straight to a file for testing.
cmd4printer -src "D:\Test\*.*" -prn "Microsoft Print to PDF" -options outputfile:"D:\TestOut\{SrcFileName}.pdf"See scheduled printing and exit codes in batch files for complete examples.
10Settings window
Run cmd4printer -ini to open the settings window and save your usual parameters as defaults; anything not given on the command line then uses them. There are six pages: Common (copies, color, orientation, duplex, paper, pages, UI language), Advanced, Print engines, Extension aliases, Watermarks (live preview drawn by the same code that prints) and the Cover page designer. Settings can be exported and imported to copy them between PCs.

Defaults are layered in this order, later ones winning: built-in defaults → %ProgramData%\Cmd4Printer\Cmd4Printer.ini (all users) → %APPDATA%\Cmd4Printer\Cmd4Printer.ini (current user) → the file given with -inipath → the command line.
cmd4printer -ini