Environment variable not resolved for menu bar [RC5 64 bit]

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *Fla$her »

2AntonyD
Quotation marks, like many other special characters, can be part of a command.
Overquoting is evil! 👎
adoeller
Junior Member
Junior Member
Posts: 82
Joined: 2011-05-23, 09:47 UTC

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *adoeller »

@ *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.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *Fla$her »

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.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 14740
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *petermad »

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.
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.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *Fla$her »

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:

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! 👎
User avatar
petermad
Power Member
Power Member
Posts: 14740
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *petermad »

2Fla$her
The author of the topic has a different nickname.
:oops: Changed it to adoeller now.

Smart solution for passing %$Desktop% to the command processor. :)
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
AntonyD
Power Member
Power Member
Posts: 1231
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *AntonyD »

Fla$her wrote: 2022-10-26, 18:09 UTC 2AntonyD
Quotation marks, like many other special characters, can be part of a command.
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.
{%DESKTOP%}
#146217 personal license
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *white »

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}%
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *ghisler(Author) »

OK, but why the trailing %? All parameters use a single percent sign.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4595
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *white »

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}%
User avatar
AntonyD
Power Member
Power Member
Posts: 1231
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *AntonyD »

I thought it would then be easy to understand if the syntax in Parameter field was: %{var}%
yep, your variant a little bit much better than mine ;)
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
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *Fla$her »

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%}
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.
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! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *ghisler(Author) »

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!
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Environment variable not resolved for menu bar [RC5 64 bit]

Post by *Fla$her »

2ghisler(Author)
I have checked several cases. It works! 👌 Thanks, especially for the pseudo-variables!
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! 👎
Post Reply