Use button bar with parentheses in the path of the command

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Beats
Junior Member
Junior Member
Posts: 15
Joined: 2008-04-21, 23:16 UTC

Use button bar with parentheses in the path of the command

Post by *Beats »

If I use a command in button bar with parentheses and without space in the path, it doesn't work (by example, c:\temp(a)\run.bat). See http://support.microsoft.com/kb/217127/en-us. I tried the command between quotes, but doesn't work too (I think because It doesn't have space in the path).

Is possible, no changing the path, make It button work?

Thanks
User avatar
sidefx88
Senior Member
Senior Member
Posts: 294
Joined: 2007-04-11, 17:07 UTC
Location: Argentina

Post by *sidefx88 »

I've tested it here (Total Commander 8.01, Windows 7 x64) and works fine with and without quotes (i used the same pathname and filename as your example).

After creating this new button for testing, this is what DEFAULT.BAT file in TC added:

button53=C:\icon.ico
cmd53=c:\temp(a)\run.bat
iconic53=0
menu53=Testing!

Cheers
I Love Total Commander!
Beats
Junior Member
Junior Member
Posts: 15
Joined: 2008-04-21, 23:16 UTC

Post by *Beats »

It doesn't work:
button27=C:\Program Files (x86)\gnuplot\bin\wgnuplot.exe
cmd27=c:\temp(a)\run.bat
param27=%P%S
path27=C:\Program Files (x86)\gnuplot\bin\
menu27=GNUPlot

It work:
button27=C:\Program Files (x86)\gnuplot\bin\wgnuplot.exe
cmd27=c:\temp_a\run.bat
param27=%P%S
path27=C:\Program Files (x86)\gnuplot\bin\
menu27=GNUPlot

I have TC 8.01 x64, con W7 Pro x64.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Batch files are executed by cmd.exe which processes parameters in a dumb way, also parentheses have special meaning for it. So, you must quote such paths in order to get it working or cmd.exe will try to execute c:\temp instead of c:\temp(a)\run.bat. So the following stupid thing should work:

Code: Select all

cmd27=cmd /c ""c:\temp(a)\run.bat"
param27=%P%S "
menu27=GNUPlot
Note additional quotes before path to batch and at the end of parameter string. cmd.exe likes to unquote passed command line very much. So the following command line will be executed by TC:

Code: Select all

cmd /c ""c:\temp(a)\run.bat" file1 file2 ... "
And the following one cmd.exe will execute:

Code: Select all

"c:\temp(a)\run.bat" file1 file2 ...
Or, I forgot to say, you may escape parentheses instead of playing with qoutes:

Code: Select all

cmd27=cmd /c c:\temp^(a^)\run.bat
param27=%P%S
menu27=GNUPlot
But quoting is a more reliable way.
Beats
Junior Member
Junior Member
Posts: 15
Joined: 2008-04-21, 23:16 UTC

Post by *Beats »

Thanks, work for me.
Post Reply