Make a Windows shortcut to compare files in Visual Studio

I like that there is a “Compare” function right out-of-the-box in Visual Studio, and even though many regular developers will choose to download a third-party application for the job, it’s perfectly fine for me.

Two problems: First off, I couldn’t find a straightforward way to open “compare” in the Visual Studio IDE without right-clicking an existing item in a source control repository. And second, wouldn’t it be cool if we could put a shortcut to it on the Windows “Send to” context menu?

This is what I’m aiming for.

Here are the basic steps:

Create a .cmd file that launches the IDE

Start out by creating a .cmd file someplace handy (I put mine in the Visual Studio “IDE” directory) that looks something like this:

@echo off
setlocal
set vspath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE
start "Compare files" /B /MIN "%vspath%\devenv.exe" /diff %2 %1 First:'%2' Second:'%1'

You may have to change the path to match the version and installation path of your Visual Studio.

Create the shortcut

Drag the .cmd file, using your right mouse button, to the SendTo folder, and create a shortcut there. My SendTo folder is located in:

%AppData%\Microsoft\Windows\SendTo

You can paste this address into the address bar of Windows Explorer. Yours may vary, depending on if you’re on a domain, and if your shop has roaming profiles or stuff like that.

Now, you can right-click a selection of two files in Windows Explorer, open the “Send to” menu and compare them in Visual Studio.

One thought on “Make a Windows shortcut to compare files in Visual Studio

  1. This is amazing. Thank you for posting this. I gave up yesterday trying to compare two local files.

Let me hear your thoughts!

This site uses Akismet to reduce spam. Learn how your comment data is processed.