How To Compare 2 Files In Edit Plus Editor

Posted on by admin

If you’re not already familiar with Notepad, it is a text editor designed for coding. Amongst it’s many benefits, this small piece of software has big features, such as allowing you to view code with colour styling and line numbers to make the code easier to read. In the current setup of compare commands 1-3 will have a - in file 2 and commands 3,1,2 will have a + in file 2 even though they are the same commands in a different order and commands 5 file 1-2 will either show blue arrows showing same command different lines or command 6 file 1 and command 5 file 2 will show the symbol for the commands are.

  1. How To Compare 2 Files In Editplus Editor Windows 10
Active2 months ago

I saw new comparsion tool in VS 2012 for comparing two files or two versions of file. I like it. But when I tried to find it I can't because I don't use TFS. Is there a way how can I just compare two files with builtin feature in VS but without TFS?

Matt
16.6k7 gold badges77 silver badges119 bronze badges
Libor ZapletalLibor Zapletal
4,98916 gold badges74 silver badges148 bronze badges

17 Answers

You can invoke devenv.exe /diff list1.txt list2.txt from the command prompt or, if a Visual Studio instance is already running, you can type Tools.DiffFiles in the Command window, with a handy file name completion:

Vladimir ReshetnikovVladimir Reshetnikov
9,0454 gold badges21 silver badges40 bronze badges

You can try VSCommands extension from Visual Studio Gallery.Latest release allows you to select two file and compare them:

Jarek KardasJarek Kardas
8,2671 gold badge26 silver badges32 bronze badges

Inspired by the accepted answer above, I found a very comfortable way how you can instantly compare two files with Visual Studio by using drag and drop or via the 'Send To' context menu. It only requires a little preparation which you need to do once and then it is useful like a Swiss army knife.

File compare using drag & drop

Preparation:
1. Create a new batch file using your favorite text editor. Type the following:

You might notice that I have reversed the %1 and %2 parameters in the batch. This is because I noticed that the file explorer passes the 2nd file as first parameter, then the 1st file as second parameter.

  1. Save this code as VS_FileCompare.cmd to use it, modify vspath if required to match the location of devenv.exe (depending on the Visual Studio version you're currently using, see footnote*) )

  2. Either create a shortcut named 'File Compare' for VS_FileCompare.cmd and place it on the desktop (as used in the animation below), so it is always available to drag & drop files onto it or directly place the batch file on the desktop. That's all!

Usage:

  1. Open the Windows explorer via Win + E
  2. Select two files to compare in the explorer
  3. Drag and drop them as shown in the animation below:

  4. After a few seconds (depending on the launch time of Visual Studio), the results will be shown in Visual Studio:

Note: It does not harm if Visual Studio is already open. In this case it will just open up a new window within the running instance of Visual Studio. So you can compare multiple file pairs, but please ensure you have selected only 2 files at a time.

Alternative way: SendTo context menu

Here's an alternative how you can use the batch file VS_FileCompare.cmd mentioned in the section above. It allows to use the context menu's Send To folder to compare the files.

Preparation:

  1. Create a shortcut 'Compare2Files VS' for the batch file VS_FileCompare.cmd and copy it into the SendTo folder. Open the Windows explorer via Win + E
  2. Open the SendTo folder by entering shell:sendto into the file explorer's address bar (as described here). Then, put the prepared shortcut into this folder.

Usage:

  1. Open the Windows explorer via Win + E
  2. Select two files to compare in the explorer
  3. Assuming the shortcut for the batch file VS_FileCompare.cmd is named 'Compare2Files VS', you can select the two files, right-click and select Send To --> Compare2Files VS to invoke the compare as shown below:

  4. After a few seconds (depending on the launch time of Visual Studio), the results will be shown in Visual Studio:

MSDN References:
- Usage of diff window
- Visual Studio's Diff parameter

*)Footnote: Because vsPath (the path to DEVENV.exe) differs depending on your version of Visual Studio, I am describing how you can find it out (Windows 10):

  1. In the Windows start menu , locate the Visual Studio icon
  2. Right-click to bring up the context menu. Select More > Open File Location.
    Windows Explorer opens with the Visual Studio shortcut highlighted.
  3. Right-Click on the Visual Studio and select Properties
  4. In the properties dialog, you can find the path in 'Target:'
MattMatt
16.6k7 gold badges77 silver badges119 bronze badges

I have always been a fan of WinMerge which is an open source project. You can plug it into Visual Studio fairly easily.

will show you how to do this

user1877337

There is also a Visual Studio extension called CompareFiles, which does nothing else but adding the 'Compare Files' entry to the solution explorer context menu. It invokes the built-in Visual Studio diff tool.

Just in case that someone (like me) doesn't want to install an all-in-one extension like VSCommands...

StephanStephan
3,4761 gold badge15 silver badges32 bronze badges

In Visual Studio 2012, 2013, 2015, you can also do it with Web Essentials, just right click the files and from context menu > Web Essential >> Diff selected files:

Edit: It's now available as a separate extension

Hamid MosallaHamid Mosalla
2,3372 gold badges16 silver badges43 bronze badges

If you have VS installed, you could also call

or for VS 2013

Source: http://roadtoalm.com/2013/10/22/use-visual-studio-as-your-diff-and-merging-tool-for-local-files/

rink.attendant.6
19k18 gold badges69 silver badges123 bronze badges
Chandramouleswaran RavichandraChandramouleswaran Ravichandra
astronoughtastronought
6,06718 gold badges79 silver badges144 bronze badges

For VS 2017 Install https://marketplace.visualstudio.com/items?itemName=vs-publisher-457497.FileComparer2017

The problem is that you can't compare files in diferent proyects, but you can copy the files in the same project to compare...

Martin
2,2747 gold badges23 silver badges26 bronze badges
Juan PabloJuan Pablo

I had this problem as well. No TFS, but I found this article helpful.

Specifically, step 1b.

Open a Visual Studio command prompt and navigate to the Common7/IDE folder and type

billbbillb
2,8581 gold badge27 silver badges35 bronze badges

In Visual Studio Code you can:

  • Go to the Explorer
  • Right click the first file you want to compare
  • Select Select for compare
  • Right click on the second file you want to compare
  • Select Compare with '[NAME OF THE PREVIOUSLY SELECTED FILE]'
jahllerjahller

File Comparer VS Extension by Akhil Mittal. Excellent lightweight tool that gets the job done.

usefulBeeusefulBee
5,5105 gold badges39 silver badges62 bronze badges

To compare any two files and merge it to one file Here are the following steps you can follow if you have visual studio(Any version) installed.

Step 1: Open Visual studio command prompt. If you do not find visual studio command prompt then choose visual studio tools

Start -> Visual studio command prompt

Step 2: Enter the command vsdiffmerge.exe

Ignore the switch /m if you need just comparison.

Syntax 1:
vsdiffmerge <file1> <file2> <file1> <outputfile> /t /m

Syntax 2:
vsdiffmerge <basefilename> <CompareFilename> <basefilename> <OutputFilename> /t /m

Example 1:
vsdiffmerge test1.js test2.js test1.js output.js /t /m
Example 2:
vsdiffmerge.exe 'C:UserslivingstonDownloadswawaFilespreTest.js' 'C:UserslivingstonDownloadswawaFilesProdTest.js' 'C:UserslivingstonDownloadswawaFilespreTest.js' 'C:UserslivingstonDownloadswawaFilesoutputsamp.js' /t /m


Step 3: Merge the files

Please note that if file name does not exists in the location, it will not open the comparer.

Also you can beautify the file before you do the comparison. In visual studio Ctrl + K + D.

There are lot of beautifier sites available online.

George LivingstonGeorge Livingston

Visual Studio code is great for this - open a folder, right click both files and compare.

niiconiico
4,18611 gold badges57 silver badges100 bronze badges
spottedmahnspottedmahn
5,8603 gold badges43 silver badges78 bronze badges

I believe this to be one of the better extension for Visual Studio 2012, it's called Code Compare and can be found here.

NathanNathan
5,8173 gold badges21 silver badges38 bronze badges

If you are working with TFS connected then right click on file which you need to compare (through source control explorer) and it presents you a window like this -

Now change path of source file in 'Souce Path:' and you get comparision through VS comparision tool.

Similarly you can compare folder also which compares all files of a folder at once.

Chetan NaithaniChetan Naithani

Not the answer you're looking for? Browse other questions tagged visual-studiofilecomparecomparisondiff or ask your own question.

Active2 months ago

I have two cloned repositories of two very similar open-source projects, which I have been working on in different instances in Sublime Text 2 to arrive at my desired result. Code from both of these projects was used. I have been using Git as version control for my project, but have not included the original projects. Thus, I would like to be able to quickly compare the contents of two files of the original project and compare the differences between them and my project.

I was hoping that Sublime Text 2 would have a 'Compare File' feature, but I can't seem to find anything related to it in the settings or online. A third-party ST2 package to accomplish this task would also work well. Is such a task possible to do within the ST2 text editor?

Suzana
3,1082 gold badges19 silver badges35 bronze badges
LanceLafontaineLanceLafontaine
2,3503 gold badges13 silver badges32 bronze badges

10 Answers

You can actually compare files natively right in Sublime Text.

  1. Navigate to the folder containing them through Open Folder... orin a project
  2. Select the two files (ie, by holding Ctrl onWindows or on macOS) you want to compare in the sidebar
  3. Right click and select the Diff files... option.
Derek 朕會功夫Derek 朕會功夫
64.7k38 gold badges143 silver badges198 bronze badges

Compare Side-By-Side looks like the most convenient to me though it's not the most popular:

UPD: I need to add that this plugin can freeze ST while comparing big files. It is certainly not the best decision if you are going to compare large texts.

DanyDany
2,6351 gold badge9 silver badges22 bronze badges

There are a number of diff plugins available via Package Control. I've used Sublimerge Pro, which worked well enough, but it's a commercial product (with an unlimited trial period) and closed-source, so you can't tweak it if you want to change something, or just look at its internals. FileDiffs is quite popular, judging by the number of installs, so you might want to try that one out.

MattDMoMattDMo
79.6k17 gold badges180 silver badges191 bronze badges

UPDATE
(Given the upvotes, I feel there is a need for a complete step-by-step explanation...)

  1. In the Menu bar click on File->Open Folder...
  2. Select a folder (the actual folder does not really matter, this step is just to make the FOLDERS sidebar available)
  3. If there is no Side Bar shown yet, make it appear via View ->Side Bar ->Show Side Bar
  4. Use this FOLDERS-titled Side Bar to navigate to the first file you want to compare.
  5. Select it (click on it), hold down ctrl and select the second file.
  6. Having two files selected, right click on one of the two and select Diff Files...

There should be a new Tab now showing the comparison.

Original short answer:
Note that:

The 'Diff files' only appears with the 'folders' sidebar (to open a folder: File->Open Folder) , not with 'open files' sidebar.

langlauf.iolanglauf.io
1,6171 gold badge11 silver badges29 bronze badges

UPDATE JAN 2018 - especially for Sublime/Mac

(This is very similar to Marty F's reply above, but addresses some issues from previous responses, combines several different suggestions and discusses the critical distinction that gave me problems at first.)

I'm using Sublime Text 3 (build 3143) on Mac and have been trying for about 30 minutes to find this File Compare feature. I had used it before on Sublime/Mac without any problems, but this time, it was trickier. But, I finally figured it out.

  1. The file format does not need to be UTF-8. I have successfully compared files that are UTF-8, ISO-8559-1, and Windows-1252.

  2. There is no File > Open Folders on Sublime/Mac. Many instructions above start with 'Select File > Open Folders,' but that doesn't exist on Sublime/Mac.

  3. File compare works on a Project basis. If you want to compare two files, they must be saved to disk and part of the current project.

  4. Ways to open a project

    • If Sublime/Mac is not running or if it's running but no windows are open, drag a folder onto the Sublime app.
    • If Sublime/Mac is running, select 'File > Open', navigate to the desired folder, don't select a file or folder and click 'Open'.
  5. Add a folder to a project. If the files you want to compare are not part of the same hierarchy, first open the folder containing one of the files. Then, select 'Project > Add Folder to Project', navigate to the folder you want and click 'Open'. You will now see two root-level folders in your sidebar.

  6. The Sidebar must be visible. You can either 'View > Side Bar > Show Side Bar' or use the shortcut, Command-K, Command-B.

  7. Files must be closed (ie, saved) to compare. Single-clicking a file in the Side Bar does not open the file, but it does display it. You can tell if a file is open if it's listed in the 'Open Files' section at the top of the Side Bar. Double-clicking a file or making a modification to a file will automatically change a file's status to 'Open'. In this case, be sure to close it before trying to compare.

  8. Select files from the folder hierarchy. Standard Mac shorcut here, (single) click the first file, then Command-click the second file. When you select the first file, you'll see its contents, but it's not open. Then, when you Command-click the second file, you'll see its contents, but again, neither are open. You'll notice only one tab in the editing panel.

  9. Control-click is not the same as right-click. This was the one that got me. I use my trackpad and often resort to Control-click as a right-click or secondary-click. This does not work for me. However, since I configured my trackpad in System Preferences to use the bottom-right corner of my trackpad as a right-click, that worked, displaying the contextual menu, with 'Delete', 'Reveal in Finder', and.... 'Diff Files...'

How To Compare 2 Files In Editplus Editor Windows 10

Voilà! I hope this helps someone.

Zonker.in.GenevaZonker.in.Geneva

UPDATE OCTOBER 2017I never knew this feature existed in Sublime Text, but the interface appears to have changed slightly from the previous answer - at least on OS X. Here are the detailed steps I followed:

  1. In the Menu Bar click File -> Open...
  2. Navigate to the FOLDER that contains the files to be compared and with the FOLDER selected, click the Open button, this makes the FOLDERS sidebar appear
  3. In the FOLDERS sidebar, click on the first file to be compared
  4. Hold the Ctrl on Windows or ⌘ on OS X, and click the second file
  5. With both files selected, right click on one and select Diff Files...

This opens a new tab showing the comparison. The first file in red, the second in green.

Marty FMarty F

View - Layout and View - Groups will do in latest Sublime 3

eg:

Shift+Alt+2 --> creates 2 columns

Ctrl+2 --> move selected file to column 2

This is for side by side comparison. For actual diff, there is the diff function other already mentioned. Unfortunately, I can't find a way to make columns scroll at the same time, which would be a nice feature.

mature
4971 gold badge8 silver badges16 bronze badges
Daniele DellafioreDaniele Dellafiore
1,1711 gold badge10 silver badges16 bronze badges

No one is talking about Linux but all above answers will work. Just use Ctrl to select more than one file. If you are looking to compare side by side, Meld is lovely.

Wannabe JavaGeekWannabe JavaGeek

There's a BeyondCompare plugin as well. It opens the 2 files in a BeyondCompare window. Pretty convenient to open files from the sublime window.

You will need BC3 installation present in the system.After installing the plugin, you will have to provide the path to the installation.

Example:

Aditya GuptaAditya GuptaPlus
1,0802 gold badges14 silver badges22 bronze badges

The Diff Option only appears if the files are in a folder that is part of a Project.

Than you can actually compare files natively right in Sublime Text.

Navigate to the folder containing them through Open Folder... or in a projectSelect the two files (ie, by holding Ctrl on Windows or ⌘ on macOS) you want to compare in the sidebarRight click and select the Diff files... option.

RicardoRicardo

protected by cassiomolinJun 17 at 11:10

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged comparesublimetext2diffsublimetextsublime-text-plugin or ask your own question.