fc: the classic command
fc (file compare) is in every Windows version. /N prints line numbers, /W ignores whitespace differences, /C ignores case and /B compares byte by byte for binary files. It prints the mismatching blocks from each file with a few lines of context.
C:\> fc /N app.conf app.conf.new
Comparing files app.conf and APP.CONF.NEW
***** app.conf
3: workers = 4
***** APP.CONF.NEW
3: workers = 8
*****
PowerShell: Compare-Object
Compare-Object works on any two collections, including the lines of two files. The SideIndicator column shows which file a line came from: => the second, <= the first. Add -IncludeEqual to see matches too, or -SyncWindow to control how far it searches for a match.
PS> Compare-Object (Get-Content app.conf) (Get-Content app.conf.new) InputObject SideIndicator ----------- ------------- workers = 8 => timeout = 30 => workers = 4 <=
WinMerge for a visual diff
WinMerge is a free, open-source diff tool with side-by-side highlighting, folder comparison, three-way merges and a Windows Explorer context menu. It is the usual answer when you want to see and merge changes rather than read a report.
Editors you may already have
VS Code compares two files without an extension (select both, right-click, Compare Selected). Notepad++ needs the ComparePlus plugin. Both are covered in their own guides. For two pieces of text that are not files yet, paste them into the online diff checker.
FAQ
Does Windows have a diff command?
Not by that name. fc is the built-in equivalent for text and binary files, and Compare-Object is the PowerShell way. If you have Git for Windows, git diff --no-index works too.
How do I compare two files in Notepad?
Notepad cannot compare files. Use fc from a command prompt, VS Code, or Notepad++ with the ComparePlus plugin.
How do I compare two folders in Windows?
WinMerge opens two folders and lists differing files; robocopy source dest /L /E lists what would be copied without copying anything, which doubles as a quick comparison.