Skip to content

Instantly share code, notes, and snippets.

@LanceMcCarthy
Created February 12, 2024 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LanceMcCarthy/f37eeccb71e520ab3d11783ed3be15b0 to your computer and use it in GitHub Desktop.
Save LanceMcCarthy/f37eeccb71e520ab3d11783ed3be15b0 to your computer and use it in GitHub Desktop.
Env Tips

To determine where an environment variable is set, you can follow these steps:

  1. Environment Variables Dialog:

    • Press Win + R to open the Run dialog.
    • Type sysdm.cpl and hit Enter.
    • Go to the Advanced tab and click the Environment Variables button.
    • Here, you'll find both user-specific and system-wide environment variables. You can view, edit, or delete them.
  2. Registry Editor:

    • Open the Registry Editor by pressing Win + R, typing regedit, and hitting Enter.
    • Navigate to HKEY_CURRENT_USER\Environment for user-specific variables.
    • For system-wide variables, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.
  3. Startup Scripts:

    • Environment variables can be set in startup scripts.
    • Check the following locations:
      • User-Specific: C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
      • System-Wide: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
  4. Group Policy:

    • If your system is part of a domain, group policies may set environment variables.
    • Use gpedit.msc to access local group policies.
  5. Application-Specific Settings:

    • Some applications set their own environment variables during installation or runtime.
    • Check application-specific documentation or settings.

Remember that environment variables can be set at different levels (user, system, process) and during various stages (startup, login, etc.). By exploring these methods, you should be able to identify where your environment variable is coming from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment