Environment variable not resolved for menu bar [RC5 64 bit]
Moderators: Hacker, petermad, Stefan2, white
Re: Environment variable not resolved for menu bar [RC5 64 bit]
2AntonyD
Quotation marks, like many other special characters, can be part of a command.
Quotation marks, like many other special characters, can be part of a command.
Overquoting is evil! 👎
Re: Environment variable not resolved for menu bar [RC5 64 bit]
@ *Fla$her: I see you like finger pointing 
Bygones:
Warning: Programs run as administrator will always start with the program directory as the start path, and environment variables (like %COMMANDER_PATH%) are NOT inherited from Total Commander, only those from the system. It also does not work directly with .bat and .cmd files. Please put cmd.exe /c in front of it.
Warnung: Als Administrator gestartete Programme erhalten immer das Programmverzeichnis als Startpfad, und erben keine Umgebungsvariablen (wie %COMMANDER_PATH%) von Total Commander, sondern nur die von Windows. Außerdem müssen Sie .bat und .cmd-Dateien mit vorangestelltem cmd.exe /c als Administrator starten.
The german translation is not correct and missleading, as the expansion of environment variables is linked to administrator mode and not a second independed case.

Bygones:
Warning: Programs run as administrator will always start with the program directory as the start path, and environment variables (like %COMMANDER_PATH%) are NOT inherited from Total Commander, only those from the system. It also does not work directly with .bat and .cmd files. Please put cmd.exe /c in front of it.
Warnung: Als Administrator gestartete Programme erhalten immer das Programmverzeichnis als Startpfad, und erben keine Umgebungsvariablen (wie %COMMANDER_PATH%) von Total Commander, sondern nur die von Windows. Außerdem müssen Sie .bat und .cmd-Dateien mit vorangestelltem cmd.exe /c als Administrator starten.
The german translation is not correct and missleading, as the expansion of environment variables is linked to administrator mode and not a second independed case.
Re: Environment variable not resolved for menu bar [RC5 64 bit]
2adoeller
Finger pointing? I didn't understand.
As for not inheriting variables, this is one of the reasons why I always run TC with rights elevation.
Finger pointing? I didn't understand.
As for not inheriting variables, this is one of the reasons why I always run TC with rights elevation.
Overquoting is evil! 👎
Re: Environment variable not resolved for menu bar [RC5 64 bit]
2adoeller
Just use:
Command: %COMSPEC% /C
Parameters: START "" "drive:\path\exsimple.exe" %P%N "%%USERPROFILE%%\Desktop\%O.pdf" px.cfg
Then the command processer will resolve %%USERPROFILE%%
You cannot use %%$DESKTOP%% since the command processor doesn't recognize the $-environment variables.
I recommend to check the "Run minimized" ("Als synmbol") option in the button configuration.
Just use:
Command: %COMSPEC% /C
Parameters: START "" "drive:\path\exsimple.exe" %P%N "%%USERPROFILE%%\Desktop\%O.pdf" px.cfg
Then the command processer will resolve %%USERPROFILE%%
You cannot use %%$DESKTOP%% since the command processor doesn't recognize the $-environment variables.
I recommend to check the "Run minimized" ("Als synmbol") option in the button configuration.
Last edited by petermad on 2022-10-26, 22:51 UTC, edited 1 time in total.
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
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
Re: Environment variable not resolved for menu bar [RC5 64 bit]
2petermad
The author of the topic has a different nickname.
%%USERPROFILE%%\Desktop is not an optimal solution because Desktop folder can be moved from %USERPROFILE%.
You can do this:
The author of the topic has a different nickname.
%%USERPROFILE%%\Desktop is not an optimal solution because Desktop folder can be moved from %USERPROFILE%.
You can do this:
Code: Select all
TOTALCMD#BAR#DATA
*%comspec% /q/v/c set "Desktop=%$Desktop%" &start
"" exsimple.exe %P%N "!Desktop!%O.pdf" px.cfg
plugins\wlx\ulister\demo64\document_blabla.ico
export PDF to Desktop
%COMMANDER_PATH%\plugins\wlx\ulister\demo64\
1
Overquoting is evil! 👎
Re: Environment variable not resolved for menu bar [RC5 64 bit]
2Fla$her
Changed it to adoeller now.
Smart solution for passing %$Desktop% to the command processor.
The author of the topic has a different nickname.

Smart solution for passing %$Desktop% to the command processor.

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
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
Re: Environment variable not resolved for menu bar [RC5 64 bit]
They can, but they will never be converted to the correct values of environment variables, since the probability that the description of the parameter with unusual brackets on the sides will use exactly the same character value, which is in fact the environment variable, will be very low. Such cases can be considered personally.Fla$her wrote: 2022-10-26, 18:09 UTC 2AntonyD
Quotation marks, like many other special characters, can be part of a command.
{%DESKTOP%}
#146217 personal license
Re: Environment variable not resolved for menu bar [RC5 64 bit]
I posted this suggestion earlier to allow environment variables in the parameter field:
white wrote: 2022-08-24, 09:23 UTC 2ghisler(Author)
How about solving it by accepting this syntax: %{COMMANDER_PATH}%
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Environment variable not resolved for menu bar [RC5 64 bit]
OK, but why the trailing %? All parameters use a single percent sign.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Environment variable not resolved for menu bar [RC5 64 bit]
I guess that would work too. I thought because environment variables in the Command field have this syntax: %var%. I thought it would then be easy to understand if the syntax in Parameter field was: %{var}%
Re: Environment variable not resolved for menu bar [RC5 64 bit]
yep, your variant a little bit much better than mineI thought it would then be easy to understand if the syntax in Parameter field was: %{var}%

In this case, we definitely exclude the possibility of misunderstanding that the symbol % is not followed by a letter - which could be interpreted as the beginning of the env.variable.
#146217 personal license
Re: Environment variable not resolved for menu bar [RC5 64 bit]
But these are not quotation marks anymore. And it's better to get rid of the probabilities to the maximum. Curly brackets can be part of a name.AntonyD wrote: 2022-10-27, 06:47 UTC the description of the parameter with unusual brackets on the sides will use exactly the same character value, which is in fact the environment variable, will be very low.
{%DESKTOP%}
It's better like this: %|ENVAR|% or %*ENVAR*%
Or even better so that there is no letter from the right percent: %|ENVAR%| or %*ENVAR%*
Overquoting is evil! 👎
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Environment variable not resolved for menu bar [RC5 64 bit]
Total Commander 11 now supports a special syntax for resolving environment variables in the parameters field:
%|ENVAR|
Please note that there is only one % sign, just like all the other parameters in that field!
%|ENVAR|
Please note that there is only one % sign, just like all the other parameters in that field!
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Environment variable not resolved for menu bar [RC5 64 bit]
2ghisler(Author)
I have checked several cases. It works!
Thanks, especially for the pseudo-variables!
There is no problem here either:
I have checked several cases. It works!
There is no problem here either:
Code: Select all
TOTALCMD#BAR#DATA
%ComSpec% /q/k echo
%%cd%%|findstr :|find "\"
wcmicons.dll,82
Overquoting is evil! 👎