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

adoeller
Junior Member
Junior Member
Posts: 82
Joined: 2011-05-23, 09:47 UTC

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

Post by *adoeller »

Hi,

This is my command:
https://www.dropbox.com/s/gdpe5xac3gxg0r7/2022-10-25%2018_19_43-Total%20Commander%2010.52RC5%20-%20Umgebungsvariable.png?dl=0

The "%$DESKTOP%" is not resolved.
https://www.dropbox.com/s/40titclec948ye7/2022-10-25%2018_20_16-Process%20Monitor%20-%20Sysinternals_%20www.sysinternals.com.png?dl=0

When entering "%$DESKTOP%" as a path directly into the tab, TC changes to my desktop.

According to the context help in this window (F1), environment variable are supposed to work. Any ideas?

Best Regards,
Alex
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

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

Post by *Dalai »

Percent signs in the parameter field need to be doubled to differentiate them from placeholder variables like %P, %N, %T and so on. Don't double the percent signs in the command field though.

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
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 »

changed to: %P%N "%%$DESKTOP%%\%O.pdf" px.cfg

this is not working, either. not resolved:
"C:\Program Files\totalcmd\plugins\wlx\ulister\demo64\exsimple.exe" "C:\Program Files\totalcmd\plugins\wlx\ulister\readme.txt" "%$DESKTOP%\readme.pdf" px.cfg
User avatar
white
Power Member
Power Member
Posts: 4596
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

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

Post by *white »

Environment variables are only supported in the Command field. These get replaced by Total Commander.

As explained by Dalai you can pass the environment variable unevaluated by doubling the percent signs. It's then up to the program that is run to replace the environment variable. It's unlikely that exsimple.exe supports the use of %$DESKTOP%. If exsimple supports normal environment variables, this might work:

Code: Select all

%P%N "%%UserProfile%%\Desktop\%O.pdf" px.cfg
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 »

I see, it's up to the according program to expand the variable. well, not working for me in this example. :/

It is strange that I can't refer to the desktop, i.e. that TC is not expanding the variable.
Fla$her
Power Member
Power Member
Posts: 2247
Joined: 2020-01-18, 04:03 UTC

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

Post by *Fla$her »

white wrote: 2022-10-25, 16:54 UTCIt's unlikely that exsimple.exe supports the use of %$DESKTOP%.
This is entirely impossible, because it is an internal variable TC.

adoeller wrote: 2022-10-25, 17:18 UTCIt is strange that I can't refer to the desktop, i.e. that TC is not expanding the variable.
If the author wanted to re-read the second line with the disclosed parameters again as part of the "Command:" field, then there would be no such problem.
The reason why this did not happen was, as far as I remember, that the names of files and folders can also contain text with variable names (Example: D:\blabla%temp%blabla\$%Destop%\%windir%blabla.txt).

As a workaround, you can use nircmd:
Command: %COMMANDER_PATH%\Utils\NirCmd\nircmd.exe exec show exsimple.exe
Paramenters: %P%N "~$folder.desktop$\%O.pdf" px.cfg
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] - solved

Post by *adoeller »

Thanks. Working with "%COMMANDER_PATH%\plugins\util\nircmd\nircmdc.exe execmd exsimple.exe"

one tool more in my toolbox :)
Fla$her
Power Member
Power Member
Posts: 2247
Joined: 2020-01-18, 04:03 UTC

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

Post by *Fla$her »

2adoeller
Why do you need a hidden cmd.exe process?
If exsimple needs to be hidden, then write hide instead of show.
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 »

With the argument "show" exsimple.exe simply wasn't working. That's why I omitted "show" .
Fla$her
Power Member
Power Member
Posts: 2247
Joined: 2020-01-18, 04:03 UTC

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

Post by *Fla$her »

Are you sure you have an "exec show exsimple.exe ", not "execmd show exsimple.exe "?
For example: nircmd.exe exec show cmd /c start "" ~$folder.desktop$
The command will execute cmd, which will open the Desktop folder.
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 »

It's execmd. Not suitable for my purpose?
Fla$her
Power Member
Power Member
Posts: 2247
Joined: 2020-01-18, 04:03 UTC

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

Post by *Fla$her »

I write that instead of execmd it is better to use exec hide, because it does not create an intermediate console process.
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) »

Indeed you can only use environment variables in the command field (which also accepts parameters), and only placeholders like %N in the parameters field, because the two would otherwise interfere with each other.
For example, %P%N could be interpreted as placeholders %P and %N, or as environment variable %P% and character N.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2247
Joined: 2020-01-18, 04:03 UTC

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

Post by *Fla$her »

ghisler(Author) wrote: 2022-10-26, 08:49 UTC because the two would otherwise interfere with each other.
>>>
Fla$her wrote: 2022-10-25, 17:34 UTC If the author wanted to re-read the second line with the disclosed parameters again as part of the "Command:" field, then there would be no such problem.
Parameters: %P%N %%ProgramFiles%%\Folder
Read for the first time: C:\Path\to\file.ext %ProgramFiles%\Folder
Read it a second time: C:\Path\to\file.ext C:\Program Files\Folder
Last edited by Fla$her on 2022-10-26, 18:20 UTC, edited 2 times in total.
Overquoting is evil! 👎
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 »

2ghisler(Author)
You can simply enter a rule to fill this field, if necessary, with environment variables only in special quotation marks.
And then no confusion.
#146217 personal license
Post Reply