guide · config files

Compare config files on Windows

Something stopped working after an update. The test server behaves differently from production. A vendor’s installer wrote its own defaults over yours. Which setting is different? Diffoniq shows two INI, JSON, XML or .config files side by side, marks the lines that differ, and leaves out what is not a setting: indentation, a byte-order mark, Windows or Unix line endings.

The short version: press Ctrl+O and enter both files. For whole installations, enter both folders with a mask such as *.ini;*.json;*.xml;*.config. To leave out re-indented lines, switch on Ignore spaces on comparison under Options → File Comparison…. To take a setting over, drag its line across and press Ctrl+S; the original is kept as a .BAK file.

1. Compare two config files

Start Diffoniq, press Ctrl+O and enter the two files, or drag both from File Explorer onto the window. From a command prompt:

"C:\Program Files\Diffoniq\Diffoniq.exe" "D:\prod\app.ini" "D:\test\app.ini"

That is the installer’s path; the portable version runs from the folder you unpacked it to. Changed lines are coloured on both sides, and inside a changed line the changed characters are marked, so Timeout=30 against timeout=60 shows both the case and the value. Tab jumps to the next difference. How to read the display is explained in Compare two text files on Windows.

Config files travel between machines, and that changes their bytes without changing a single setting: a file edited on a Linux server comes back with Unix line endings, an editor adds a byte-order mark. Diffoniq recognizes the encoding and the line endings of each side and compares the text. In our test, an INI file with Windows line endings against a copy with Unix line endings and a byte-order mark showed exactly one changed line, the one with the changed value. The header above each pane names encoding and line endings, and shows both in amber when they differ, so you still see that the files are not byte-identical.

Comparison of D:\prod\app.ini against D:\test\app.ini: the left header reads ANSI and CRLF, the right header UTF-8+BOM and LF, both pairs in amber; of eight lines only line 4 differs, Timeout=30 on the left and timeout=60 on the right with the changed characters marked; the status bar reads 1 changed
Different encoding and line endings, one changed setting. The header shows ANSI and CRLF against UTF-8 with byte-order mark and LF, in amber. The comparison itself finds only line 4.

2. Leave out what is not a setting

Options → File Comparison… decides what counts as a difference. Change a switch and both files are compared again.

The files differ inSwitchAs delivered
Indentation: a JSON or XML file saved with four spaces instead of two, or tabs instead of spacesIgnore spaces on comparisonoff
Spaces at the end of a lineIgnore trailing blankson
Tabs against spaces in the displayExpand tabs before comparison, Tabsizeon, 4
Upper and lower case, such as [Server] and [server]Case insensitive compareoff

In our test, a JSON file re-indented from two to four spaces showed eight changed lines out of ten. With Ignore spaces on comparison it showed none, and when one value had changed as well, only that line remained. Keep in mind that a switch applies to the whole line: Case insensitive compare also stops showing a value whose only change is its case, such as a path or a password. Switch it on to find the settings that really changed, and off again before you rely on the result.

3. Know what a line comparison shows

Diffoniq compares lines, not the structure of JSON or XML. That is usually what you want with configuration: you see the file as it is stored. Two consequences are worth knowing.

4. Compare whole configuration folders

An application rarely has one config file. To compare two installations, a server against its backup, or a deployment package against what is installed, enter the two folders instead of two files. A mask in the path limits the comparison to configuration files:

D:\prod\*.ini;*.json;*.xml;*.config
D:\test\*.ini;*.json;*.xml;*.config

The mask applies to files only; subfolders are still scanned, so a config file two levels down is found too. Folders full of logs and caches still appear as folders. Leave them out with the Exclude field of each side, for example logs;cache;*.log; an excluded folder disappears with everything in it. Save the selection under a name in the same dialog, and the next check is a double-click. Details: Select Files.

Either side can be a ZIP file instead of a folder, so a deployment package is compared against the installation without unpacking it first. The list shows which files differ and which exist on one side only; double-click a file to see its lines. More on folder comparison in Compare two folders on Windows.

5. Take settings over, with a way back

Mark the lines you want on the other side and drag them across the separator; or copy them with Ctrl+C, mark the lines to replace and press Ctrl+V. Nothing is written until you press Ctrl+S. Then the original is kept with .BAK appended to its full name: app.ini becomes app.ini.BAK, web.config becomes web.config.BAK. If your settings break something, the old file is right next to it. The encoding and line endings of the file are kept when it is written back. Details: Merging Changes and Save Modifications.

Two command-line switches decide for one run only and are never stored. When the left file is the production copy that you only want to read, lock it:

"C:\Program Files\Diffoniq\Diffoniq.exe" /read-only-left "\\server01\app\app.ini" "D:\work\app.ini"

And when the file lives in a Git working tree, where an extra .BAK file would show up as untracked, save without the copy for this run with /no-backup; /backup does the opposite. Details: Command Line Arguments.

6. Check for drift from a script

Has anyone changed the live configuration since the last release? Keep a reference copy and let a scheduled task compare it. The console launcher DiffoniqC.exe waits for the result and returns an exit code: 0 when everything is the same, 1 when something differs.

"C:\Program Files\Diffoniq\DiffoniqC.exe" /report "D:\reference\*.ini;*.json;*.xml;*.config" "D:\live\*.ini;*.json;*.xml;*.config" --exclude "logs;cache" --content --out drift.html

Use --content: without it, two files of the same size are not read and are only counted as “not compared”. A reordered config file keeps its size, so exactly that change would slip through. A report of two single files takes the comparison switches too: /s leaves out spaces and tabs, /c upper and lower case. The whole recipe, with PowerShell and the JSON format, is in Compare two folders from the command line.

Good to know

Other ways to compare config files

Windows has fc /n in the command prompt, and git diff --no-index compares two files outside a repository. Both look at the bytes. In our test with the INI file from step 1, fc reported the first line as different because of the byte-order mark, and git diff marked all eight lines as changed because the line endings differed; the one changed value was among them. In PowerShell, Compare-Object (Get-Content a.ini) (Get-Content b.ini) lists the lines found in one file only, without a side-by-side view. Free tools such as WinMerge show the files side by side; our comparison page shows how they differ from Diffoniq, with the date we checked.

Questions

Can Diffoniq ignore the order of keys in JSON or XML? No. It compares lines, so a moved entry shows as removed in one place and added in another. Step 3 shows what that looks like.

The files look completely different, but they hold the same settings. Why? Usually indentation: switch on Ignore spaces on comparison. Encoding and line endings are already handled; the header shows them in amber when they differ.

Can I compare only the config files of two installations? Yes. Put a mask such as *.ini;*.json;*.xml;*.config after both folder paths, and exclude log and cache folders.

Is my original file kept when I save? Yes, as .BAK next to it, unless you switch that off under Options → File Comparison… or start with /no-backup.

Which Windows versions does it run on? Windows 10 and 11, 64-bit.

Try it on your own config files

Diffoniq runs on Windows 10 and 11, 64-bit. Every feature is available for 30 days before you decide.

Windows and PowerShell are trademarks of Microsoft Corporation. Git is a trademark of Software Freedom Conservancy. WinMerge and WinSCP are trademarks of their respective owners. Diffoniq is not affiliated with any of them.