[Implemented in Tc11.03rc3] [Tc11] Suggestion: COMMANDER_INI_PATH

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Implemented in Tc11.03RC2] [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

%COMMANDER_INI_PATH% = D:\
%COMMANDER_INI_PATH%\file.ext = D:\\file.ext
Agree - that should not be so :shock:
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *ghisler(Author) »

But returning D: instead of D:\ would also be wrong! That's why I first added the backslash to the variable.
Btw, Total Commander removes duplicate backslashes from the above situation when replacing environment variables.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

Btw, Total Commander removes duplicate backslashes from the above situation when replacing environment variables.
Not excactly.

This button:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC% /C echo %COMMANDER_INI_PATH%\file && pause

%COMMANDER_EXE%,2
Test %COMMANDER_INI_PATH%
removes the duplicate backslash.

This button does not:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC% /C 
echo %|COMMANDER_INI_PATH|\file && pause
%COMMANDER_EXE%,2
Test %COMMANDER_INI_PATH%
Neither does this:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC% /C 
echo %%COMMANDER_INI_PATH%%\file && pause
%COMMANDER_EXE%,2
Test %COMMANDER_INI_PATH%
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *JOUBE »

ghisler(Author) wrote: 2024-01-24, 07:52 UTC But returning D: instead of D:\ would also be wrong!
Wrong/not wrong: doesn’t matter. It's about practice: and D: is better in this case as D:\

Just my 2 cents

Joube
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *AntonyD »

Code: Select all

C:\Users\Public>cd d:\

C:\Users\Public>d:\
"d:\" is not an internal or external command, executable program, or batch file.

C:\Users\Public>d:

d:\>c:

C:\Users\Public>cd d:
d:\

C:\Users\Public>
cd d:\ => does not work.
d:\ => does not work + at least we have some comments about the failing result.
d: => DOES work! we switched to the next disk! And we fall into the root of this disk.
c: => also DOES work and LOOK! we returned back into the previously active folder! NOT in the root of this disk!!!!
cd d: => does not work + we have very strange "comment" (yep, it looks like as a hint - WHAT I should enter as a command
parameter - but we already for sure know that this variant is NOT working, so what is that?)

so obviously that we must return disk D: without \
#146217 personal license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *ghisler(Author) »

OK, I have tested now how %COMMANDER_PATH% handles it: It doesn't append a backslash in the root. So while it's technically incorrect (D: is just the drive and D:\ the drive root) I will change it to that also in %COMMANDER_INI_PATH%.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *JOUBE »

ghisler(Author) wrote: 2024-01-25, 08:47 UTC OK, I have tested now how %COMMANDER_PATH% handles it: It doesn't append a backslash in the root. So while it's technically incorrect (D: is just the drive and D:\ the drive root) I will change it to that also in %COMMANDER_INI_PATH%.
You can add this to the description in the help and explicitly point out the “technical” part.

By the way, others handle it completely differently, if I see it right, for example: java always appends a backslash, which it also not "technically correct".

So it is the apps choice itself, and also app specific taditionally.
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *hi5 »

ghisler(Author) wrote: 2024-01-25, 08:47 UTC%COMMANDER_INI_PATH%
I'm trying to read the value for COMMANDER_INI_PATH from the registry in these locations:
"HKEY_CURRENT_USER\Environment"
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
but they always come up empty, but when I do a simple echo %COMMANDER_INI_PATH% on a command line it is displayed correctly.
Where are these values stored? Otherwise I have to resort to the IniFileName in "HKEY_CURRENT_USER, Software\Ghisler\Total Commander"
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *beb »

2hi5
The variables are stored nowhere* there [see a quote from Microsoft Learn below].
Each time the TotalCommander starts it creates a set of its variables in the current process scope.
The variables are alive and accessible for a user (via %commander_*%, $env:commander_*, etc) while the TotalCommander process is running.
As soon as the TotalCommander process ends its variables are gone.
Image: https://i.imgur.com/q3ECdO7.png
Image: https://i.imgur.com/eD3ZM0t.png
Machine: The environment variable is stored or retrieved from the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment key in the Windows operating system registry.
User: The environment variable is stored or retrieved from the HKEY_CURRENT_USER\Environment key in the Windows operating system registry.
*Process: The environment variable is stored or retrieved from the environment block associated with the current process.
Note. If a user uses a truly portable setup there also might be no Software\Ghisler registry entries at all, and even if some data is there it might not reflect actual locations when a user has several copies of the TotalCommander, and/or relocates TotalCommander after the primary installation.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *ghisler(Author) »

Actually the variables are stored in the called app's environment, they don't disappear when Total Commander closes.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: [Implemented in Tc11.03rc3] [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *JOUBE »

Implemented in Tc11.03rc3: Tc11 Suggestion: COMMANDER_INI_PATH

Thanks.

Joube
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Implemented in Tc11.03rc3] [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

Moderator message from: petermad » 2024-01-30, 14:18 UTC

24 posts about the CD command split to "Behavior of CD command for C: v.s C:\"
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: [Implemented in Tc11.03rc3] [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *JOUBE »

Together with the other new environment variables (COMMANDER_INI_PATH together with COMMANDER_INSTANCE, COMMANDER_OPEN, COMMANDER_SESSIONNAME) it is now perhaps almost nearly too much? I don't mean the size of the consumption of characters in the environment but the number of elements themselves. Maybe should be careful with the number of elements for one single App so that it doesn't become conspicuous and cause astonishment?

It is true, it's only within TC. But TC is very often used as a starter of apps and with scripts and so on.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

[OT] Re: [Implemented in Tc11.03rc3] [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *petermad »

2JOUBE
So you think Windows will throw a Greta Thunberg :wink:
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

[OT] Re: [Implemented in Tc11.03rc3] [Tc11] Suggestion: COMMANDER_INI_PATH

Post by *JOUBE »

petermad wrote: 2024-02-03, 11:27 UTC 2JOUBE
So you think Windows will throw a Greta Thunberg :wink:
? Maybe it's a Windows/Greta Thunberg joke understandable only for Scandinavians? ;-)
Post Reply