/Diff (devenv.exe)

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

Compares two files. The differences are displayed in a special Visual Studio window.


devenv /Diff SourceFile TargetFile [SourceDisplayName [TargetDisplayName]]


  • SourceFile

    Required. The full path and name of the first file to be compared.

  • TargetFile

    Required. The full path and name of the second file to be compared.

  • SourceDisplayName

    Optional. The display name of the first file.

  • TargetDisplayName

    Optional. The display name of the second file.


If an instance of the IDE is already open, the file comparison appears in a tab in the current IDE.


The first example compares two files without changing their display names. The second example compares the files while changing both of their display names. The third and fourth examples compare two files but apply an alias to only the first file or the second file.

devenv /diff File1.txt File2.txt

devenv /diff File1.txt File2.txt FirstAlias "Second Alias"

devenv /diff File1.txt File2.txt "File One"

devenv /diff File1.txt File2.txt "" FileTwo

See also