environment variables env windows

Environment Variables and Windows 10

Published by Soufiane Sabiri | Categories : Computers - Windows 10

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 windows 1

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“.

environment variables windows 2 system advanced system settings

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

environment variables windows 3 environment variables

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.

environment variables windows 4 env variables add
environment variables windows 5 et

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

environment variables windows 6 run et
environment variables windows 7 easytutorial folder

Feel free to ask any questions! I will be very happy to reply to your requests!


Related tutorials:


Author: Soufiane Sabiri

Soufiane is a young computer scientist and specialist in web design, knows a lot of things in the computer world. This enthusiast enjoys helping people innovate and learn more about the IT world...

Be the first to leave a comment !

Leave a comment

xD oO ^_^ =] =) ;-( ;) :| :woot: :whistle: :sleep: :sick: :police: :p :o :ninja: :mm: :love: :lol: :kiss: :hmm: :evil: :bandit: :angel: :alien: :D :) :( 8)