Environment Variables in Windows 10  

Page 1 of 4 123 ... LastLast
    Environment Variables in Windows 10

    Environment Variables in Windows 10

    Complete List of Environment Variables in Windows 10
    Published by Category: General Tips
    15 Dec 2022
    Designer Media Ltd

    Complete List of Environment Variables in Windows 10


    Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can be used both in scripts and on the command line. Environment variables makes it easy when certain standard directories and parameters need to be referenced but where the actual locations or names can vary from computer to computer.

    The variable (ex: "%UserProfile%") is used as a type of shortcut of the value (ex: "C:\Users\<username>").

    There are two types of environment variables: user environment variables (set only for current user) and system environment variables (set for all users).

    This tutorial will show you a complete list of default environment variables that can be used to reference standard directories and parameters in Windows 10.

    User environment variables are stored in the registry key below:

    HKEY_CURRENT_USER\Environment

    System environment variables are stored in the registry key below:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

    You can open a command prompt, type set, and press Enter to display all current environment variables on your PC.

    You can open PowerShell, type Get-ChildItem Env:, and press Enter to display all current environment variables on your PC.




    Environment Variables Values (may vary)
    %ALLUSERSPROFILE% C:\ProgramData
    %APPDATA% C:\Users\(user-name)\AppData\Roaming
    %CD% (command prompt only) Current directory full path
    %CMDCMDLINE% (command prompt only) Returns exact command line used to start current cmd.exe session.
    %CMDEXTVERSION% (command prompt only) Number of current command processor extensions.
    %CommonProgramFiles% C:\Program Files\Common Files
    %CommonProgramFiles(x86)% C:\Program Files (x86)\Common Files
    %CommonProgramW6432% C:\Program Files\Common Files
    %COMPUTERNAME% The computer name of the current local system.
    %COMSPEC% C:\Windows\System32\cmd.exe
    %DATE% (command prompt only) Current date in format determined by Date command
    %DriverData% C:\Windows\System32\Drivers\DriverData
    %ERRORLEVEL% (command prompt only) Number defining exit status of previous command or program
    %HOMEDRIVE% C:
    %HOMEPATH% \Users\(user-name)
    %LOCALAPPDATA% C:\Users\(user-name)\AppData\Local
    %LOGONSERVER% \\MicrosoftAccount
    %NUMBER_OF_PROCESSORS% 8
    %OneDrive% Current OneDrive folder location
    %OS% Windows_NT
    %PATH% C:\WINDOWS
    C:\WINDOWS\system32
    C:\WINDOWS\System32\Wbem
    C:\WINDOWS\System32\WindowsPowerShell\v1.0
    %PATHEXT% COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    %PROCESSOR_ARCHITECTURE% AMD64
    %PROCESSOR_IDENTIFIER% Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
    %PROCESSOR_LEVEL% 6
    %PROCESSOR_REVISION% 3c03
    %ProgramData% C:\ProgramData
    %ProgramFiles% C:\Program Files
    %ProgramFiles(x86)% C:\Program Files (x86)
    %ProgramW6432% C:\Program Files
    %PROMPT% (command prompt only) Code for current command prompt format. Code is usually $P$G
    %PSModulePath% C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    %PUBLIC% C:\Users\Public
    %RANDOM% (command prompt only) To get random number between 0 and 32767
    %SessionName% When logging on directly to machine, returns "Console".

    When client connects via terminal server session, is combination of
    connection name, followed by pound symbol {#} and session number.
    %SystemDrive% C:
    %SystemRoot% C:\Windows
    %TEMP% C:\Users\(user-name)\AppData\Local\Temp
    %TIME% (command prompt only) Current time in format determined by Time command
    %TMP% C:\Users\(user-name)\AppData\Local\Temp
    %USERDOMAIN% The network domain name associated with the current user.
    %USERDOMAIN_ROAMINGPROFILE% The network domain name associated with the current roaming profile.
    %USERNAME% (user-name)
    %USERPROFILE% C:\Users\(user-name)
    %WINDIR% C:\Windows


    That's it,
    Shawn Brink






  1. Posts : 30
    Windows 10
       #1

    How we use this?
    For example tried %OS% on CMD, PS and RUN but not work?
      My Computer


  2. Posts : 68,667
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Hello Yasak, :)

    The %OS% variable contains a symbolic name of the operating system family to distinguish between differing feature sets in batchjobs. In this case, it would for when you want to use the Windows_NT string.

    I'm not sure what you could use it for though.
    Last edited by Brink; 07 Mar 2016 at 11:17.
      My Computers


  3. Posts : 30
    Windows 10
       #3

    Ok understood.
    Thank you for answer :)
      My Computer


  4. Posts : 68,667
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

      My Computers


  5. Posts : 14,901
    Windows 10 Pro
       #5

    Shawn,
    Do you know why I cannot access certain environment variables?
    For example, if I want to go to %appdata% through search I get this result

    I also cannot get access to 'Change my environment variables' in User Account.
    Last edited by Brink; 16 Sep 2017 at 21:06. Reason: removed broken image
      My Computers


  6. Posts : 68,667
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #6

    Hello Martijn, :)

    Odd. That looks more like it's through "Open with" instead of Search.

    Are you able to open Environment Variables using the path below instead?

    Environment Variables in Windows 10-environment_variables.png
      My Computers


  7. Posts : 14,901
    Windows 10 Pro
       #7

    That pops up when I enter %appdata% in search through Windows logo + r search, if I presss only Windows logo it works fine.

    Yes that works fine.
      My Computers


  8. Posts : 68,667
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    Interesting. %AppData% opens the C:\Users\Brink\AppData\Roaming folder for me in the Run command dialog.

    What does it open when you use %AppData% in the address bar of File Explorer and press Enter? It will be interesting to know if it does the same, or opens the correct folder.
      My Computers


  9. Posts : 14,901
    Windows 10 Pro
       #9

    That opens the right path C:\Users\<user>\AppData\Roaming.
    Last edited by axe0; 07 Jul 2016 at 04:43. Reason: removed name
      My Computers


 

Tutorial Categories

Environment Variables in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  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 18:36.
Find Us




Windows 10 Forums