EXEs that I've added to System PATH don't work from the Registry


  1. Posts : 24
    Windows 11 Pro 64-bit 22H2 22621.1
       #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
    Code:
    RunHiddenConsole.exe
    (GitHub - wenshui2008/RunHiddenConsole: Hide console window for windows programs)

    I added it to my system PATH along with some other executables:
    Code:
    C:\Tools\scripts\PATH
    Now, if I invoke the script manually via Command Line like this:

    Code:
    RunHiddenConsole powershell.exe -file "C:\Tools\scripts\CopyDirStructure.ps1" "C:\Tools\speccy"
    Everything is peachy and the script runs as expected.

    If I run it via the registry:

    EXEs that I've added to System PATH don't work from the Registry-dbf2z.png

    And then invoke the command:

    EXEs that I've added to System PATH don't work from the Registry-s0ql7.png

    I just get this generic file open dialogue:

    EXEs that I've added to System PATH don't work from the Registry-gkodk.png

    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.
      My Computer


  2. Posts : 42,994
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Thanks- I wondered if that was so, but my comment would have just been speculation.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:30.
Find Us




Windows 10 Forums