CLI Quick Start & Command Reference

Everything you need to run folder comparisons, integrate with CI/CD, and set up Git mergetool — from the command line.

Two modes in one exe

DirectoryCompare Pro ships as a single portable exe. It has two modes depending on how you call it:

ModeHow to invokeWhat it does
GUIDirectoryComparePro.exeOpens the full graphical interface
CLIdircompare <dir1> <dir2>Headless folder comparison — output to terminal, no window
MergetoolDirectoryComparePro.exe -m BASE LOCAL REMOTE MERGEDOpens merge dialog for Git conflict resolution, exits with code

Basic folder comparison

dircompare C:\project\v1 C:\project\v2

Shows a summary of differences: files changed, added, removed.

Compare three or more folders

dircompare C:\src C:\backup --extra-source C:\archive

Deep content comparison (hash-based)

dircompare C:\src C:\backup --deep

Uses SHA-256 hashing instead of size/date. Catches files that look identical but have different content.


Full flag reference

FlagDescription
-h, --helpShow help and exit
-v, --versionShow version and exit
-q, --quietSuppress progress output — ideal for CI/CD pipelines
--deepEnable deep content comparison (SHA-256 hash-based)
--extra-source <dir>Add another source for N-way comparison (repeatable)
--export-csv <file>Export results to CSV
--export-html <file>Export results to HTML report
--export-json <file>Export results to JSON
--filter <pattern>Exclude files matching pattern — wildcards supported, repeatable
--copy-to-dir2Copy missing/different files to dir2 (2-source only)
--copy-to-dir1Copy missing/different files to dir1 (2-source only)
--limit <N>Show only the first N differences in output
--no-summarySkip summary — exit code only (0 = identical, 1 = differences)
--smart-alignmentEnable smart folder alignment (default)
--no-smart-alignmentDisable smart folder alignment

Export examples

CSV report

dircompare C:\prod C:\staging --deep --export-csv results.csv

HTML report with filter

dircompare C:\src C:\backup --filter "*.exe" --filter "node_modules/*" --export-html report.html

N-way JSON export

dircompare dir1 dir2 --extra-source dir3 --extra-source dir4 --export-json results.json

CI/CD silent mode (exit code only)

dircompare C:\prod C:\staging --quiet --no-summary
echo Exit code: %ERRORLEVEL%
REM 0 = identical, 1 = differences found

Git mergetool setup Free

Register DCP as Git's merge conflict resolver. 3-way merge is free in Basic tier — no license required.

Step 1 — Add to your .gitconfig

[mergetool "dcp"]
    cmd = "C:/path/to/DirectoryComparePro.exe" -m "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    trustExitCode = true

[merge]
    tool = dcp
Use forward slashes in the path, even on Windows. Replace C:/path/to/ with wherever you extracted the exe.

Step 2 — Use it

git merge feature/my-branch
# conflict!
git mergetool
# DCP opens once per conflicted file — resolve, save, close

DCP exits 0 when all conflicts are resolved and saved, 1 when cancelled. Git uses the exit code to decide whether to mark the file as resolved.

For a full walkthrough of Git branch comparison (not just merging), see the Git integration guide.

Exit codes

CodeMeaning
0Comparison complete — sources are identical (or merge saved successfully)
1Differences found (or merge cancelled)
2Error — bad arguments, path not found, or permission denied