How to get System PATH rather than user PATH

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

How to get System PATH rather than user PATH

Post by BGM » 09 Jun 2021, 21:09

In my script, I want to fetch the environmental var, PATH so I can search it.

My problem is that envget will fetch only the user's PATH, but I need the system's PATH.

Am I just missing something?

User avatar
mikeyww
Posts: 27215
Joined: 09 Sep 2014, 18:38

Re: How to get System PATH rather than user PATH

Post by mikeyww » 09 Jun 2021, 21:15

When I checked with EnvGet, it showed both paths together. Another way for system path:

Code: Select all

RegRead, path, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment, Path
MsgBox, 64, Path, %path%

User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: How to get System PATH rather than user PATH

Post by BGM » 09 Jun 2021, 21:51

Thanks for the alternate function - that *does* fetch the system PATH.

I'm using RapidIEE to inspect the PATH - and envget fetches User Variables, whilst the function you just showed fetches System Variables.
It shows all the paths concatenated with ; like it ought to.

Wait - I tried envget again, and NOW it fetches the Path from System Variables.
I'm not sure what I did to get it to take from just the User Variables, but it did, I swear it did.

Post Reply

Return to “Ask for Help (v1)”