Page 4 of 5

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

Posted: 2024-01-23, 19:50 UTC
by petermad
%COMMANDER_INI_PATH% = D:\
%COMMANDER_INI_PATH%\file.ext = D:\\file.ext
Agree - that should not be so :shock:

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-24, 07:52 UTC
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.

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-24, 11:59 UTC
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%

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-24, 12:17 UTC
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

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-24, 14:44 UTC
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 \

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-25, 08:47 UTC
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%.

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-25, 08:54 UTC
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.

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-28, 19:47 UTC
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"

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-28, 21:31 UTC
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.

Re: [Tc11] Suggestion: COMMANDER_INI_PATH

Posted: 2024-01-29, 11:27 UTC
by ghisler(Author)
Actually the variables are stored in the called app's environment, they don't disappear when Total Commander closes.

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

Posted: 2024-01-29, 18:11 UTC
by JOUBE
Implemented in Tc11.03rc3: Tc11 Suggestion: COMMANDER_INI_PATH

Thanks.

Joube

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

Posted: 2024-01-30, 14:20 UTC
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:\"

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

Posted: 2024-02-03, 06:09 UTC
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.

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

Posted: 2024-02-03, 11:27 UTC
by petermad
2JOUBE
So you think Windows will throw a Greta Thunberg :wink:

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

Posted: 2024-02-03, 15:17 UTC
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? ;-)