Menu

Command Line Usage

Ben Olden-Cooligan

This page has moved:
www.naps2.com/doc-command-line.html
The content below may be out of date.

Command Line Overview

NAPS2, in addition to the primary GUI, also offers a command-line interface (CLI) via the NAPS2.Console.exe program. This allows scanning and saving documents to be automated and/or scripted.

Usage

NAPS2.Console uses standard unix-style options. Each option has a long form (e.g. "--output"), and some have a short form (e.g. "-o"). Some options are flags, and some are expected to be provided a value.

Required Options

At least one of these options must be specified.

-o, --output {path}
This specifies the path, name, and extension of the output file to save. The extension determines the output type (e.g. ".pdf" for a PDF file, ".jpg" for a JPEG image, etc.).

e.g.
naps2.console -o "F:\scanned receipt.pdf"

-e, --email {filename}
This specifies that an email should be sent with the scan attached with the given file name and extension. The extension determines the attachment type (e.g. ".pdf" for a PDF file, ".jpg" for a JPEG image, etc.).

Import Options

-i, --import {filenames}
This specifies the name and path of one or more pdf/image files to import. Imported files are prepended to the output in the order they are specified. Multiple files are separated by a semicolon (";").

e.g.
naps2.console -i "F:\incomplete scan.pdf" -o "F:\complete scan.pdf"

Combining and Converting Files

The -i/--import option can be used in combination with the option "-n 0" to combine multiple files together or to change the type of a file without doing any scanning.

e.g. To combine multiple images into a PDF:
naps2.console -i "F:\a.jpg;F:\b.jpg;F:\c.jpg" -n 0 -o "F:\abc.pdf"

e.g. To combine multiple PDFs together:
naps2.console -i "F:\a.pdf;F:\b.pdf;F:\c.pdf" -n 0 -o "F:\abc.pdf"

e.g. To convert a TIFF into a PDF:
naps2.console -i "F:\a.tiff" -n 0 -o "F:\a.pdf"

e.g. To convert between image types:
naps2.console -i "F:\a.png" -n 0 -o "F:\a.jpg"

Email Options

These options are only applicable if -e/--email is specified.

--to {address}
Specifies one or more addresses (comma-separated) of the email recipients.

--cc {address}
Specifies one or more addresses (comma-separated) of the email recipients.

--bcc {address}
Specifies one or more addresses (comma-separated) of the email recipients.

--subject {subject}
Specifies the subject of the email message.

--body {text}
Specifies the body text of the email message.

--autosend
Specifies that the email should be sent without prompting the user to edit it first. Note that Outlook may not allow the email to be sent without user approval.

--silentsend
Requires --autosend. Specifies that the user should not be prompted to authenticate. This may result in an error if authentication is required. Note that Outlook may not allow the email to be sent without user approval.

OCR Options

If OCR options aren't specified, the options from the GUI are used.

--ocrlang {code}
Specifies the three-letter code for the language used for OCR (e.g. 'eng' for English, 'fra' for French, etc.). Implies --enableocr. Reference: http://www.loc.gov/standards/iso639-2/php/code_list.php

--enableocr
Specifies that OCR should be used when generating PDFs.

--disableocr
Specifies that OCR should NOT be used when generating PDFs. Overrides --enableocr.

Other Options

-p, --profile {name}
This specifies the name of the profile to use when scanning. Profiles are defined using the GUI. If this option is not specified, the most-recently-used profile from the GUI is selected.

e.g.
naps2.console -o "F:\scanned receipt.pdf" -p "Canon MP495 (color)"

-v, --verbose (flag)
Displays progress information. If not specified, no output will be displayed upon success.

e.g.
naps2.console -o "F:\scanned receipt.pdf" -v

-n, --number {#}
(Default: 1) The number of scans to perform. This may be different from the number of pages scanned (e.g. if you have an automated document feeder).

e.g.
naps2.console -o "F:\scanned receipts.pdf" -n 5

-d, --delay {#}
(Default: 0) The delay (in milliseconds) between each scan.

e.g.
naps2.console -o "F:\scanned receipts.pdf" -n 5 -d 5000

-f, --force (flag)
Overwrite existing files. If not specified, any files that already exist will not be changed (and an error message will be displayed).

e.g.
naps2.console -o "F:\scanned receipt.pdf" -f

-w, --wait (flag)
After finishing, wait for user input (enter/return) before exiting.

e.g.
naps2.console -o "F:\scanned receipt.pdf" -w

--help
Display a help screen similar to this wiki page.

e.g.
naps2.console --help