Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running NotePad++ from Command line with Compare Plugin showing compare result

I am trying to find a way to call notepad++ from command line with compare plugin showing the compare result providing I pass 2 files name which I want to compare.

Think like I have a batch file, which does some work and result is opening notepad++ showing 2 files in compare mode. (Yes, compare plugin is installed)

If anyone has any other suggestion to using any other editor or software also welcome..

like image 434
Rohit Goyal Avatar asked Nov 24 '13 02:11

Rohit Goyal


2 Answers

tl;dr:

The command is Notepad++\plugins\ComparePlugin\compare.exe file1 file2.

Details:

Download the compare plugin https://bitbucket.org/uph0/compare/downloads/ComparePlugin.v1.5.6.6.bin.zip. Installing the compare plugin from the plugin manager within Notepad++ does not install the requisite exe. I assume you could also build from source to obtain the exe.

Follow the manual installation instructions in the readme:

To install manually, copy ComparePlugin.dll and ComparePlugin subfolder into the plugins directory C:\Program Files\Notepad++\Plugins.

For a portable Notepad++ installation, you need to run the command from a directory above the notepad++ directory (or with absolute path of exe), otherwise you get an error that Notepad++.exe is not found.

The commands look like this:

>cd C:\portapps\Notepad++
>cd ..
>Notepad++\plugins\ComparePlugin\compare.exe C:\files\file1.txt C:\files\file2.txt

ufo's answer put me on the right track but it did not contain the commands to run.

like image 155
taz Avatar answered Sep 28 '22 02:09

taz


There's a tool called NppCompareLoader doing exactly what you want. Simply drop it in the N++ installation folder. I'm using it since many years as a diff viewer for TortoiseSVN and TortoiseGit, thus you should certainly be able to call it right from command line.

/EDIT

Since the (unofficial) Compare-plug-in version 1.5.6.6 the additional loader mentioned above isn't required anymore. There's already one included in the plug-in. Here's the regarding change-log fragment:

  • NEW: Loader for using N++ as an external diff viewer (e.g. in TortoiseSVN, TortoiseGit, ..)
like image 44
ufo Avatar answered Sep 28 '22 03:09

ufo