naps2
Home / Guides / Automation

naps2 Command Line - Automating Scans with NAPS2.Console

By naps2 Editorial Team19 November 20266 min read
naps2 Command Line - Automating Scans with NAPS2.Console

Beyond its graphical interface, naps2 includes a capable command-line tool. With it, you can scan, apply OCR, combine files and save output from scripts and scheduled tasks, without ever opening a window.

Key takeaways
  • NAPS2.Console.exe provides full command-line scanning on Windows.
  • Use -p for the profile, -o for output and --ocrlang for OCR.
  • Schedule scripts with Task Scheduler or cron for unattended scanning.
  • programmers can build custom tools with the NAPS2.Sdk libraries.

Where to find the console tool

On Windows, the command-line interface is NAPS2.Console.exe, located in the naps2 installation folder (usually C:\Program Files\naps2) or in the portable folder. On macOS and Linux, the same functionality is available through the main application with a console argument, for example:

Begin with a command that scans one page into a test folder. Check the exit status and open the resulting file before adding a schedule, batch processing or automatic file naming.

Use distinct output paths to prevent accidental overwrites, and record useful error messages without exposing sensitive document contents. Run the final workflow under the same user account and scanner permissions it will use in production.

flatpak run com.naps2.Naps2 console --help

Running the tool with --help lists every available option for your installed version, which is the authoritative reference.

Your first command-line scan

The simplest useful command scans with an existing profile and saves the result:

NAPS2.Console.exe -o "C:\Scans\document.pdf" -p "Documents"

Here, -o sets the output file and -p names the profile created in the graphical interface. The format is chosen from the file extension, so .pdf, .tif, .jpg and .png all work.

Commonly used options

  • -o – output path, which may include date and number placeholders.
  • -p – the profile to scan with.
  • -n – the number of scans to perform, useful for several flatbed pages.
  • -i – import existing files to include, separated by semicolons.
  • --ocrlang – the OCR language code, such as eng or urd.
  • -f or --force – overwrite an existing output file.
  • -v – verbose output for troubleshooting.

Option names occasionally change between major versions, so confirm them with --help on your system.

Adding OCR from the command line

To create a searchable PDF in one step, add the OCR language option:

NAPS2.Console.exe -o "C:\Scans\$(YYYY)-$(MM)-$(DD).pdf" -p "Documents" --ocrlang eng

The relevant language data must already be downloaded through the graphical interface. Multiple languages can be combined using a plus sign, for example eng+urd.

Combining and converting existing files

The console tool is also handy without a scanner. To merge several images or PDFs into one document:

NAPS2.Console.exe -i "page1.jpg;page2.jpg;page3.jpg" -o "combined.pdf"

Adding --ocrlang to this command makes the combined PDF searchable, offering a simple way to apply OCR to images obtained from other sources.

Scheduling automatic scans on Windows

Save your command in a batch file, such as scan-inbox.bat, then open Task Scheduler, create a basic task, choose a trigger (daily at 18:00, for example) and set the action to run the batch file. Each evening, whatever is in the feeder will be scanned, recognised and saved with a dated file name.

Scripting on macOS and Linux

On Unix-like systems, the same approach works with shell scripts and cron. A minimal script might be:

#!/bin/sh
flatpak run com.naps2.Naps2 console -o "$HOME/Scans/scan.pdf" -p "Documents" --ocrlang eng

Make it executable with chmod +x and schedule it with crontab -e.

Error handling and logging

When scripts run unattended, logging matters. Use the verbose option and redirect output to a file so that you can review what happened later. Check the exit code in your script; a non-zero value indicates that the scan or save failed, allowing you to send a notification or retry.

A complete Windows batch-file example

The following batch file scans the feeder with a profile, applies OCR, saves a dated file and records the outcome in a log:

@echo off
set NAPS="C:\Program Files\naps2\NAPS2.Console.exe"
set OUT=D:\Scans\Inbox\$(YYYY)-$(MM)-$(DD)_$(nnn).pdf
%NAPS% -p "Feeder Documents" -o "%OUT%" --ocrlang eng -v >> D:\Scans\scan-log.txt 2>&1
if errorlevel 1 echo Scan failed on %date% %time% >> D:\Scans\scan-log.txt

Place a shortcut to this file on the desktop and a single double-click produces a searchable, sequentially named PDF from whatever is in the feeder.

Splitting output into multiple files

The console tool can also divide output, which is useful when a single scan contains several separate documents. Options allow you to split into individual pages, into fixed-size groups or at patch-T separator sheets, mirroring the behaviour of the graphical Batch Scan dialogue. Combined with the $(nnn) numbering placeholder, each resulting document receives its own unique file name automatically.

Using the naps2 SDK for programmers

For programmers who need more than the command line, the project publishes NAPS2.Sdk, a set of .NET libraries that expose scanning, image processing, OCR and PDF export to custom applications. The SDK is licensed under the LGPL, which permits use in a wide range of projects, while its samples are provided under the MIT licence. programmers can, for example, build a dedicated scanning station for a reception desk or integrate scanning into an internal business application.

Security considerations for automation

Automated scripts should write only to folders with appropriate permissions, particularly when documents are confidential. Avoid saving into widely shared network locations by default, protect log files that might reveal document names, and run scheduled tasks under an account with the minimum privileges necessary. These precautions keep automation convenient without compromising privacy.

Testing commands safely

When building scripts, test with harmless settings first. Scan to a temporary folder, use the verbose option to see exactly what happens, and open the output to confirm orientation, resolution and OCR. Only once the command behaves as expected should you point it at your real archive or schedule it. Keeping a short text file of working commands with comments also helps colleagues maintain the automation later.

Using placeholders effectively

Placeholders are what make command-line output manageable. Date tokens such as $(YYYY), $(MM) and $(DD) organise files chronologically, time tokens distinguish multiple scans in a day, and numbering tokens like $(nnn) guarantee unique names. Folder paths can contain placeholders too, so a single command can create a new monthly folder automatically:

-o "D:\Scans\$(YYYY)\$(MM)\scan_$(nnn).pdf"

Command-line reference at a glance

The table below gathers the most frequently used options in one place. Always confirm them against --help on your own installation, since options can evolve between releases.

OptionPurposeExample
-oOutput file path-o scan.pdf
-pProfile name-p "Documents"
-nNumber of scans-n 3
-iImport files-i "a.jpg;b.jpg"
--ocrlangOCR language(s)--ocrlang eng+urd
-fOverwrite output-f
-vVerbose logging-v

When the command line is the wrong tool

Automation is not always the best answer. If documents vary greatly in size, condition or orientation, a person reviewing thumbnails in the graphical interface will often produce better results than an unattended script. The command line shines for predictable, repetitive work – the same kind of paper, the same profile, the same destination every time. Recognising which tasks fit that pattern is the key to using naps2 automation effectively.

Practical automation ideas

  • A desktop shortcut that scans the feeder straight into a dated, searchable PDF.
  • A nightly job that converts images dropped into a folder into one OCR-enabled PDF.
  • A reception desk script that scans visitor forms into a shared network folder.
  • An accounts workflow that saves invoices with sequential numbers for easy reconciliation.

Test the output before scheduling a job

Run the naps2 console command on one disposable page and write the result to a temporary folder. Open the output and check the page count and orientation against the source. If you asked for OCR, search the PDF for a word you can see on the page. Capture the exit status and any error text in your script so a failed scan does not look like a successful run.

Scheduled jobs often run with different permissions from an interactive session. Test from the account that will run the job, verify that it can see the naps2 profile and scanner, and confirm that it can write to the output folder. Use a separate file for each test so that a stale PDF cannot be mistaken for a fresh scan.

Frequently asked questions

Yes. NAPS2.Console is part of every naps2 installation and portable package.

Yes. The console uses profiles created in the graphical interface to know which scanner and settings to use.

Yes. Use the OCR language option, provided the language data has been downloaded.

Yes. Run the main naps2 application with the console argument.

Yes. Use -n with the number of scans; naps2 can wait between scans so you can change pages.

Conclusion

The naps2 command line turns a capable scanner application into an automation tool. With a profile, an output path and an optional OCR language, you can build scripts and scheduled tasks that file paperwork automatically – a genuine time-saver for offices and power users alike.

Download naps2 for Windows (x64)