I am hoping there is a simple answer for this is. Is there a command that would give me a list of all User Environment variables? (or value of a user Environment variable if it exists). I know there is 'set' command, however it lists both user and system variables. I am running a script and I would like to know if a particular environment variable exists in user variables. Only other option would be using registry information. But I would like to know if this is possible with a commandline or something similar.
Thanks
On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables.
Select Start, select Control Panel. double click System, and select the Advanced tab. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it.
In the System > About window, click the Advanced system settings link at the bottom of the Device specifications section. In the System Properties window, click the Advanced tab, then click the Environment Variables button near the bottom of that tab.
Querying the registry is probably the most simple method of returning only User environment variables:
reg query HKEY_CURRENT_USER\Environment
This is an example of what output is returned:
λ reg query HKEY_CURRENT_USER\Environment
HKEY_CURRENT_USER\Environment
ChocolateyLastPathUpdate REG_SZ 132148451031142736
ChocolateyToolsLocation REG_SZ C:\tools
ip REG_SZ ipconfig /all | findstr /IR "ipv4 ethernet adapter" | findstr /IRV "description tunnel vpn dial bluetooth [2-9]:$" | findstr /LV "*"
Path REG_EXPAND_SZ C:\PATH\gnuwin32\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
QB REG_SZ tasklist /FI "IMAGENAME eq qbittorrent.exe"
TEMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp
TMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With