Page 1 of 1

Do not require full path for asterisk use

Posted: 2024-11-07, 08:01 UTC
by KozakMak
It would be great if this:
*C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

also worked in this one:
*powershell.exe

Re: Do not require full path for asterisk use

Posted: 2024-11-07, 10:22 UTC
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.

Re: Do not require full path for asterisk use

Posted: 2024-11-07, 10:25 UTC
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

Re: Do not require full path for asterisk use

Posted: 2024-11-07, 11:09 UTC
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.

Re: Do not require full path for asterisk use

Posted: 2024-11-07, 11:25 UTC
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.

Re: Do not require full path for asterisk use

Posted: 2024-11-07, 12:00 UTC
by Dalai
2white
True, but the PowerShell directory is also part of the %PATH%.