Run Compare v2 in cmd
-
I am trying to run a comparison of two files from the command line.
The command I have researched online is Notepad++\plugins\ComparePlugin\compare.exe file1 file2I navigate to Notepad++\plugins\ComparePlugin but there is no compare.exe file. I only see git2.dll and sqlite3.dll
In the plugins directory there is a ComparePlugin.dll file but no .exe file. I tried reinstalling the Compare plugin but still no .exe file.
Does anyone know how I can run the compare from the command line without the .exe?
-
Compare Plugin stopped distributing the compare.exe at some point. And there is no built-in way of running specific features of a plugin from the command line – unless the plugin has made use of Notepad++'s
-z
feature… but ComparePlugin has not (at some point, one of you who is looking for compare-starting-from-command-line should make a request in the Compare Plugin issues/feature-request page ).However, last month’s conversation on a similar request has some pointers for how to get started making a PythonScript solution to parse the Notepad++
-z
feature, after which the PythonScript could start the ComparePlugin comparison on the two files. -
Thanks for the info. I’ll look into the scripting solution
-
Hello, @eric-castilleja, @peterjones and All,
The diff-wiever
compare.exe
exists in the oldComparePlugin.v1.5.6.6.bin.zip
archive and, probably, in thev1.5.6.7
version, too !Unfortunately, this program is absent in all further releases of the
ComparePlugin
So here is the road map :
-
1) With the
Plugin Admin
, install the lastv2.0.1
release of thecomparePlugin
. ( You may also install it, manually, from that link -
2) Now, download the old
1.5.6.6.
version of the Compare plugin, from :
https://bitbucket.org/uph0/compare/downloads/ComparePlugin.v1.5.6.6.bin.zip
-
3) From the
ComparePlugin
folder of that archive, extract the two files,compare.exe
andcompare.ini
, only :-
In the folder
%AppData%\Notepad++\plugins\ComparePlugin\ComparePlugin
, along with the two librariesgit2.dll
andsqlite3.dll
, if you previously installed Notepad++, with the Installer -
In folder
<N++ installation> folder\plugins\ComparePlugin\ComparePlugin
, along with the two librariesgit2.dll
andsqlite3.dll
, if your installation of N++ was a local installation, from a7z
orzip
archive, in any folder
-
-
4) Only in case of a local installation of Notepad++, you must configure the
compare.ini
file, by adding, in the[Notepad]
section, the line :
path=<ABSOLUTE path of Notepad++>\notepad++.exe
Notes :
The environment variables, as, for instance,
%PROGRAMFILES(X86)%
or%USERPROFILE%
and/or the special directories.
and..
can be used to constitute the absolute path of N++, needed in thecompare.ini
file ( NO need to surround all the path, with single or double quotes, if your path contains spaces )Remark :
In case of a local N++ installation, the two files
compare.exe
andcompare.ini
can be placed anywhere, as soon as they are, both, in the same folder ! ( Just remember that absolute path, for further use, of course ! )-
5) Now, close any running instance of Notepad++
-
6) Then, from the “Start” menu, run a
cmd
command -
7) Inside the DOS console window, whatever the current directory, type the command :
<ABSOLUTE path of compare.exe\compare.exe ABSOLUTE or RELATIVE path\File_A ABSOLUTE or RELATIVE path\File_B
with a space character after the expressions compare.exe and File_A
=> Your current Notepad++ should start, soon, with, only, the two
File_A
andFile_B
files, already compared ;-))
For instance, with my local N++
7.9.2
configuration :-
The
compare.exe
andcompare.ini
files are, both, in theD:\@@
folder -
The
compare.ini
file contains the active linepath=D:\@@\792\notepad++.exe
, within the[notepad]
section -
All files and sub-folders, of my local N++ installation, are in folder
D:\@@\792
-
After starting a
cmd
command and acd /d D:\@@\792
command -
I just typed the command
D:\@@\compare.exe license.txt license_2.txt
wherelicense_2.txt
is a copy oflicense.txt
, slightly modified
=> Notepad++
v7.9.2
started with the two files opened in each view, and the comparison process terminated ;-)) Just as you would have run the commandnotepad++ -nosession license.txt license_2.txt
with, in addition, the comparison process already launched !Notes :
-
When using
compare.exe
, remember to indicate, in theDOS
command, its absolute path ! -
Of course, the location of two compared files can be completely independent
-
If a path of the files to compare ( absolute or relative ) contains spaces, just surround it with double quotes
-
I used the
v7.9.2
release for tests but this method should work with later versions !
Best Regards,
guy038
P.S. :
This post is an update of this old post
Moreover, you might be interested in the @dinkumoil’s solution, too, which comes next !
-
-
Has there been any update in this? I too and trying to script compares for my clients but the compare.exe is still missing. Is there an effort to get the program back in the new release?