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 file2

    I 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?



  • @Eric-Castilleja ,

    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 old ComparePlugin.v1.5.6.6.bin.zip archive and, probably, in the v1.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 last v2.0.1 release of the comparePlugin. ( 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 and compare.ini, only :

      • In the folder %AppData%\Notepad++\plugins\ComparePlugin\ComparePlugin, along with the two libraries git2.dll and sqlite3.dll, if you previously installed Notepad++, with the Installer

      • In folder <N++ installation> folder\plugins\ComparePlugin\ComparePlugin, along with the two libraries git2.dll and sqlite3.dll, if your installation of N++ was a local installation, from a 7z or zip 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 the compare.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 and compare.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 and File_B files, already compared ;-))


    For instance, with my local N++ 7.9.2 configuration :

    • The compare.exe and compare.ini files are, both, in the D:\@@ folder

    • The compare.ini file contains the active line path=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 a cd /d D:\@@\792 command

    • I just typed the command D:\@@\compare.exe license.txt license_2.txt where license_2.txt is a copy of license.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 command notepad++ -nosession license.txt license_2.txt with, in addition, the comparison process already launched !

    Notes :

    • When using compare.exe, remember to indicate, in the DOS 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 !


Log in to reply