Bonus chatter: Using the Visual Studio diff window to compare any files

A neat little trick I discovered recently, and promptly forgot to share is that you can make use of Visual Studio’s diff window for any pair of files, without the need for a project or solution. All you need is a little command line trickery.

For VS2012 you can type:

"%VS110COMNTOOLS%/../IDE/devenv.exe" /diff {fileOne} {fileTwo} {displayNameOne} {displayNameTwo}

(If you’re running VS2013, you can use the environment variable VS120COMNTOOLS instead)

Just replace {fileOne} and {fileTwo} with the absolute paths to the files you want to compare. You can optionally provide {displayNameOne} and {displayNameOne} as “friendly names” for the two diff panes.

And up pops a window like:

Untitled

Could be useful for scripts and tools that need to display differences between files…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s