[TC10.52] Help text incorrect about running programs as Administrator

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

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

[TC10.52] Help text incorrect about running programs as Administrator

Post by *white »

Help - Dialog box: Configuration - Change button bar wrote: 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.
I tested this on my Windows 11 system and it is not as described in the help.

There is only a problem when TC is not running as Administrator and I run programs as Administrator. This is assumed in the text below.

Environment variables like %COMMANDER_PATH% are NOT inherited from Total Commander. This is also the case when running batch files, no matter if I put cmd.exe /c in front of it.

The start path is another matter. The default start path is the active panel folder. There is an issue if the program is located in c:\Windows\ or c:\Windows\System32\ or c:\Windows\SysWOW64\. Then the start path is ignored and the folder c:\windows\system32 is always used as start path. So this also the case for batch files because they are run via cmd.exe located in c:\Windows\System32\.

Example:
I copied cmd.exe and en-US\cmd.exe.mui in the c:\windows\system32 folder to d:\TEST\cmd. So I have these files/folders:

Code: Select all

d:\TEST\cmd\cmd.exe
d:\TEST\cmd\en-US\cmd.exe.mui
I created a button with Command *d:\TEST\cmd\cmd.exe and Start path empty. When I click the button, an elevated Command Prompt opens in the active panel folder (same as when not running as Administrator). The COMMANDER_* environment variables are not inherited.

This is a Windows thing. The same happens when I run a program as Administrator using Windows Explorer or Windows Run.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *ghisler(Author) »

So what do you expect me to change? Just the help text?
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *white »

Yes, just the help text.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *ghisler(Author) »

This should be fixed in TC 11 beta, please check it in the new help.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *white »

I can confirm that the help text changed to:
Warning: Programs run as administrator will not start with the current directory set to the "Start path" field on most Windows versions. Environment variables (like %COMMANDER_PATH%) are NOT inherited from Total Commander, only those from the system. Starting also does not work directly with .bat and .cmd files. Please put cmd.exe /c in front of it.
However, I think it is not very clear. The German text is better, but I still have questions.

Issue: Programs started as Administrator do not use the Start path field on most Windows versions
Only if Total Commander is not run as Administrator?

Issue: Environment variables specific to Total Commander are not inherited by programs started as Administrator
Only if Total Commander is not run as Administrator and regardless of Windows version?

Issue: .bat and .cmd files must be preceded by cmd.exe /c
Only if you want to run them as administrator?
And only if Total Commander is not run as Administrator?
On most Windows versions? (not necessary on my Windows 11 system)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *ghisler(Author) »

Issue: Programs started as Administrator do not use the Start path field on most Windows versions
Only if Total Commander is not run as Administrator?
It's about when you put an asterisk in front of the command while TC isn't running as administrator. Then the launched program doesn't receive the current path from Windows.
Issue: Environment variables specific to Total Commander are not inherited by programs started as Administrator
Only if Total Commander is not run as Administrator and regardless of Windows version?
Yes, that's how it is written.

Sorry, I will not change this any further. Saying more would probably introduce new incorrectness.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *white »

ghisler(Author) wrote: 2023-05-04, 07:28 UTC Sorry, I will not change this any further. Saying more would probably introduce new incorrectness.
Well, maybe not saying more but saying it differently and more vague, like this:
Warning: If Total Commander is not run as an administrator, be aware of the following issues when running programs as an administrator:
* Environment variables specific to Total Commander (like %COMMANDER_PATH%) will not be inherited by the programs.
* In most Windows versions, the programs will not run in the folder indicated by the "Start path" field.
* If the program is a batch file (.bat or .cmd file), you may need to precede it with cmd.exe /c.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *ghisler(Author) »

Nice wording, I will use that, thanks!
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC10.52] Help text incorrect about running programs as Administrator

Post by *white »

Tested OK using TC 11.00b4 English and German language. Looks good :)

Moderator message from: white » 2023-05-26, 10:07 UTC

Moved to Fixed bugs.
Post Reply