Assigning Environment Variables


  1. Press WIN+X to open the Windows Menu and choose "System"


  2. In the Search Field search for "Environment" and choose "Edit the system environment variables:



  3. Choose the Environment Variables option in the Dialog


  4. In the following dialog you can add an environment variable. You have two options to add them
    • Just to your user account (1)
    • To the entire system (2)



  1. In the "New" DIalog add your Environment Variable Name and Value



  2. Changes to Environment Variable require a System Reboot to take effect



In Linux, environment variables can be set either temporarily (for the current session) or permanently (by modifying shell configuration files).


To set a temporary environment variable open a terminal and use the following syntax


export VARIABLE_NAME=value


This variable will remain active only in the current terminal session. Once you close the terminal, it will no longer be available.


To set environment variables permanently, you can add them to your shell's configuration file. Most commonly, this is the .bashrc file (for Bash users) or .zshrc file (for Zsh users).

Use a text editor like nano or vim to open the .bashrc file. The .bashrc file is a hidden file in your user directory. If you are unsure where to find it, use the following command in a terminal:

nano ~/.bashrc


Scroll to the end of the file and add the variable via the export command


export VARIABLE_NAME=value


Save the file and restart the terminal.


If you wish to confirm that a variable is active (temporary or persistent) you can use the echo command:

echo $MY_VAR