Running WinMerge from a User Button

Discuss and share scripts and script files...
Post Reply
Nick Name
Posts: 2
Joined: 08 Aug 2011 11:58

Running WinMerge from a User Button

Post 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!

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Running WinMerge from a User Button

Post 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).
One of my scripts helped you out? Please donate via Paypal

Nick Name
Posts: 2
Joined: 08 Aug 2011 11:58

Re: Running WinMerge from a User Button

Post 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!

admin
Site Admin
Posts: 66259
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Running WinMerge from a User Button

Post by admin »

Nice example. I added it to the Help file. :)

Post Reply