-Parameters in button bar->button not working

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Wesley.Chan
Junior Member
Junior Member
Posts: 2
Joined: 2014-03-06, 02:24 UTC

-Parameters in button bar->button not working

Post by *Wesley.Chan »

I created a button in the button bar.
I set the command to

Code: Select all

cmd.exe
Then I set the parameters to

Code: Select all

/k set PATH=C:\MinGW\bin;%PATH%
Save and exit. Activate this button. A command line window shows up.
I input

Code: Select all

echo %PATH%
and press enter. It says

Code: Select all

C:\MinGW\bin\;C:\msys\opt\bin\ATH
Thats incorrect.

Now I'm doing in another way.
I set the command to

Code: Select all

cmd.exe /k set PATH=C:\MinGW\bin;%PATH%
And leave the Parametes blank.
Save and exit. Activate it again and give the same command. It says

Code: Select all

C:\MinGW\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\ProgramFiles\SlikSvn\bin;C:\Program Files\Mercurial\;C:\Program Files\TortoiseHg\;C:\Program Files\TortoiseSVN\bin
That's fine.

So, please fix it. Thank you for your time.
pikadung
Junior Member
Junior Member
Posts: 13
Joined: 2009-09-11, 05:27 UTC

Post by *pikadung »

this is not a bug because the "%P" is specified as a command line parameter. use "%%" in order to insert percent-sign in the parameter field.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Wesley.Chan,
Environment variables in Parameters field are not supported. Also, %P in parameters is expanded to active panel's path (press F1 in buttonbar configure dialog to read about all %-parameters). You need to use your second case with envvar in Command field, or double % characters as pikadung suggested, but note that in such case TC will pass exact %PATH% string to a program and it will be responsible in expanding variable (CMD supports it so it should work).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed this isn't a bug, but different handling of the % character in the command and parameters field.
Author of Total Commander
https://www.ghisler.com
Wesley.Chan
Junior Member
Junior Member
Posts: 2
Joined: 2014-03-06, 02:24 UTC

Post by *Wesley.Chan »

MVV wrote:Wesley.Chan,
Environment variables in Parameters field are not supported. Also, %P in parameters is expanded to active panel's path (press F1 in buttonbar configure dialog to read about all %-parameters). You need to use your second case with envvar in Command field, or double % characters as pikadung suggested, but note that in such case TC will pass exact %PATH% string to a program and it will be responsible in expanding variable (CMD supports it so it should work).
I see. Thank you.
Post Reply