How to user COMMANDER_PATH in user command?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
valuex
Junior Member
Junior Member
Posts: 25
Joined: 2014-12-25, 13:53 UTC

How to user COMMANDER_PATH in user command?

Post by *valuex »

I've set a user command in user.ini like this.

Code: Select all

[em_savealltabs]
button=wcmicons.dll,10
cmd=SAVETABS2
param=%COMMANDER_PATH%\SAVETABS2.tab
But everytime I run it by clicking the buttion added in toolbar,the output file name is not the expected value SAVETABS2.tab, but looks like below.

Code: Select all

User.iniOMMANDER_PATHSAVETABS2.tab
User.iniOMMANDER_PATHSAVETABS2.tabOMMANDER_PATHSAVETABS2.tab
User.iniOMMANDER_PATHSAVETABS2.tabOMMANDER_PATHSAVETABS2.tabOMMANDER_PATHSAVETABS2.tab
There are two problems here:
1. It seems that %COMMANDER_PATH% in user.ini is not interperated and coverted to the absolute path correctly.
2. If the file *.tab exists, the newly created file will have a different name while not overwrite it.
Could you help to share your idea on how to fix it? Thanks.
User avatar
Dalai
Power Member
Power Member
Posts: 9963
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How to user COMMANDER_PATH in user command?

Post by *Dalai »

Percent signs of environment variables must be doubled in the Parameters field. That's because of several placeholders like %C, %P, %N and so on that can be used there. Percent signs must not be doubled in the Command field though. In TC 11 you can also use %|env_var| instead.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 16021
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: How to user COMMANDER_PATH in user command?

Post by *petermad »

License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
valuex
Junior Member
Junior Member
Posts: 25
Joined: 2014-12-25, 13:53 UTC

Re: How to user COMMANDER_PATH in user command?

Post by *valuex »

petermad wrote: 2023-09-10, 09:22 UTC 2valuex
See also: https://ghisler.ch/board/viewtopic.php?p=440811#p440811 and forward.
Thanks for sharing this link, and below code works as expected.

Code: Select all

[em_savealltabs]
button=wcmicons.dll,10
cmd=SAVETABS2
param="%|commander_path|\SAVETABS2.tab"
Post Reply