Page 1 of 1

Running WinMerge from a User Button

Posted: 08 Aug 2011 12:07
by Nick Name
Greetings all,

I've been trying for a while to write a simple User Button that runs WinMerge (a popular comparison tool) in order to compare the current panes.
Thing is, it works - until i try to enter some command line options to the WinMerge executable.

What i would like to run is somethings like this:

Code: Select all

"C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /r "<tab 1 folder>" "<tab 1 folder>"
But i have no idea on how to accomplish this.

1. If if simply use

Code: Select all

run "C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /r "<get path 1>" "<get path 2>"
the /e /r are interpreted as math operation and i get a division by zero

2. If i use

Code: Select all

run '"C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /r' "<get path 1>" "<get path 2>"
i get a "file not found" error - probably xyplorer considers the switches to be part of the exe path.

3. If i use

Code: Select all

run '"C:\Program Files (x86)\WinMerge\WinMergeU.exe" /e /r "<get path 1>" "<get path 2>"'
the "<get path X>" are not substituted anymore. WinMerge runs fine, but it tries to compare the "<get path 2>" and "<get path 1>" (literal) folders.

I'm stumped. I tried to find a similar case in the documentation, but i couldn't. In the forums there is another thread talking about WinMerge integration, but for a completely differente problem.
Can somebody please point me to an example of a similiar case?

Thank you all in advance!

Re: Running WinMerge from a User Button

Posted: 08 Aug 2011 13:57
by highend
Easy...

Code: Select all

run """C:\Program Files (x86)\WinMerge\WinMergeU.exe"" /e /r ""$Arg1"" ""$Arg2"""
Just enclose your program (WinMergeU.exe with path) and all of your variables ($Arg1 & $Arg2 (that should be substituted with real paths, files, whatever)) in double quotes and add an additional quote at the beginning and at the end of the line (hence the three quotes there).

Re: Running WinMerge from a User Button

Posted: 08 Aug 2011 14:32
by Nick Name
Hey, thanks!
I used:

Code: Select all

run """C:\Program Files (x86)\WinMerge\WinMergeU.exe"" /e /r ""<get path 1>"" ""<get path 2>"""
and it works like a charm!

Thanks again!

Re: Running WinMerge from a User Button

Posted: 23 Aug 2011 18:13
by admin
Nice example. I added it to the Help file. :)