Do not require full path for asterisk use

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Do not require full path for asterisk use

Post by *KozakMak »

It would be great if this:
*C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

also worked in this one:
*powershell.exe
OS: Win10 | TC: latest x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Do not require full path for asterisk use

Post by *ghisler(Author) »

I think that it's a Windows security feature that programs aren't found when run as administrator without path. It doesn't work with other programs like cmd.exe or notepad.exe either.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Do not require full path for asterisk use

Post by *white »

I assume the suggestion is this:

For executables registered in the "App Paths" registry, being able to run them as administrator without specifying the full path, similar to how the Windows Run dialog works.

For reference, the relevant registry locations are:
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths
User avatar
Dalai
Power Member
Power Member
Posts: 9943
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Do not require full path for asterisk use

Post by *Dalai »

2white
Not every application is registered in the registry branch App Paths. Any executable located somewhere in the %PATH% can also be specified without an absolute path, and be launched that way.



One approach could be to search for the executable in every location specified in %PATH% and registry's App Path. However, since multiple locations can contain an executable with the same name, the search result can be ambiguous and thus might not be what the users expects. This can even be dangerous, especially since we're talking about launching something elevated.

For me personally this isn't an issue. I try to specify absolute paths wherever I can to avoid such ambiguities. I even do that within batch files to make sure the correct command is executed. The reason is that CMD tries to launch executables in the order specified in %PATHEXT%, meaning .COM files are tried before .EXE.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Do not require full path for asterisk use

Post by *white »

Dalai wrote: 2024-11-07, 11:09 UTC 2white
Not every application is registered in the registry branch App Paths. Any executable located somewhere in the %PATH% can also be specified without an absolute path, and be launched that way.
I know, but the OP speaks of powershell.exe and that executable is in the registry branch App Paths.
User avatar
Dalai
Power Member
Power Member
Posts: 9943
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Do not require full path for asterisk use

Post by *Dalai »

2white
True, but the PowerShell directory is also part of the %PATH%.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply