New
#1
EXEs that I've added to System PATH don't work from the Registry
I have an exe that runs PowerShell scripts (or any executable) completely hidden. It's called(GitHub - wenshui2008/RunHiddenConsole: Hide console window for windows programs)Code:RunHiddenConsole.exe
I added it to my system PATH along with some other executables:Now, if I invoke the script manually via Command Line like this:Code:C:\Tools\scripts\PATH
Everything is peachy and the script runs as expected.Code:RunHiddenConsole powershell.exe -file "C:\Tools\scripts\CopyDirStructure.ps1" "C:\Tools\speccy"
If I run it via the registry:
And then invoke the command:
I just get this generic file open dialogue:
I get the same thing even if I completely remove the script from the command key and leave it as just "RunHiddenConsole". If I include the entire path to the exe it works. But that's defeating the purpose of adding it to my System PATH.
Do any of you have any idea what's going on? I really can't figure this out.
Thanks for any help.
- - - Updated - - -
Found the reason why in another forum. Posting the reply here in case someone else runs into the same thing:
The registry command is not run through CMD and therefore is missing many features, and especially the environment variables that CMD creates from the registry, most importantly the PATH variable.
You could replace the registry command by cmd /c RunHiddenConsole..., but that would sort of defeat the purpose of using RunHiddenConsole.
Another possibility is copying RunHiddenConsole to C:\Windows\System32, which is always searched, although modifying this very important Windows folder should not be done unless absolutely necessary.
Your best solution is really to specify the whole path to the RunHiddenConsole program, as the PATH is not very useful in this case.