Environment variables are a set of dynamic named values that can affect the how processes run on your PC.
From their name we learn that they are part of the environment in which a process runs.
You can create your own environment variables, or use those available on the system.
For example, to display the username of the current user you can use the following command on your command prompt (CMD
in Run):
ECHO %USERNAME%

Environment Variables on Windows 10
Default Environment Variables
Here is a table containing all environment variables, you can create your own! Scroll down to know how.
Variable | Description |
---|---|
%ALLUSERSPROFILE% | Location of the All Users Profile. |
%APPDATA% | Location where applications store data by default. |
%CD% | Current directory string. |
%CMDCMDLINE% | Exact command line used to start the current cmd.exe. |
%CMDEXTVERSION% | Version number of the current Command Processor Extensions. |
%COMPUTERNAME% | Name of the computer. |
%COMSPEC% | Exact path to the command shell executable. |
%DATE% | Current date. This variable uses the same format as the date /t command. Cmd.exe generates this variable. For more information about the date command, see the Date command. |
%ERRORLEVEL% | Error code of the most recently used command. A non-0 value usually indicates an error. |
%HOMEDRIVE% | Local workstation drive letter that is connected to the user’s home directory. This variable is set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups. |
%HOMEPATH% | Full path of the user’s home directory. This variable is set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups. |
%HOMESHARE% | Network path to the user’s shared home directory. This variable is set based on the value of the home directory. The user’s home directory is specified in Local Users and Groups. |
%LOGONSEVER% | Name of the domain controller that validated the current logon session. |
%NUMBER_OF_PROCESSORS% | Number of processors installed on the computer. |
%OS% | OS name. |
%PATH% | Search path for executable files. |
%PATHEXT% | List of the file extensions that the OS considers to be executable. |
%PROCESSOR_ARCHITECTURE% | Processor’s chip architecture. Values: x86, IA64. |
%PROCESSOR_IDENTFIER% | Description of the processor. |
%PROCESSOR_LEVEL% | Model number of the computer’s processor. |
%PROCESSOR_REVISION% | Revision number of the processor. |
%PROMPT% | Command-prompt settings for the current interpreter. Cmd.exe generates this variable. |
%RANDOM% | Random decimal number between 0 and 32767. Cmd.exe generates this variable. |
%SYSTEMDRIVE% | Drive containing the Windows root directory (i.e., the system root). |
%SYSTEMROOT% | Location of the Windows root directory. |
%TEMP% or %TMP% | Default temporary directories for applications that are available to users who are currently logged on. Some applications require TEMP and others require TMP. |
%TIME% | Current time. This variable uses the same format as the time /t command. Cmd.exe generates this variable. For more information about the time command, see the Time command. |
%USERDOMAIN% | Name of the domain that contains the user’s account. |
%USERNAME% | Name of the user currently logged on. |
%USERPROFILE% | Location of the profile for the current user. |
%WINDIR% | Location of the OS directory |
You can create your own environment variables, here is how to do it.
Create Your Own Environment Variables
In order to create your own environment variables we need to open the System window, press CTRL+X or right-click on Start. Click on “System“.
You can also use the shortcut Windows+Pause to open the System window.
Click on “Advanced system settings“.

Select the tab “Advanced” and click on the button “Environment Variables…” at the bottom of the System Properties window.

Choose a variable and a value for it. Here I want to create a directory environment variable %ET%
for my own use that points to the C:\easytutorial
directory.


Click “OK” and open Run (Windows+R) to test the variable.


Feel free to ask any questions! I will be very happy to reply to your requests!
Be the first to leave a comment !