Environment variables are system-wide variables which share the same value. These variables are often parsed by the shell when executing commands, and are expanded into their appropriate variable. For example, this allows users to move file locations without needing to update hard-coded paths in scripts (they just have to update the environment variable).
Questions tagged [environment-variables]
1279 questions
758
votes
8 answers
How can I display the contents of an environment variable from the command prompt in Windows 7?
In Windows 7, when I start the Command prompt, is there any command to display the contents of an environment variable (such as the JAVA_HOME or PATH variables)?
I have tried with echo $PATH, echo PATH and $PATH but none of these work.
![](../../users/profiles/27037.webp)
Jonas
- 26,874
- 52
- 105
- 125
405
votes
5 answers
What are PATH and other environment variables, and how can I set or use them?
Questions about
setting environment variables
the PATH
are very common here, and in most cases the answers are very similar to each other. In the future it would be nice to have a good Q/A for this.
So the question is: What are environment…
![](../../users/profiles/48078.webp)
slhck
- 223,558
- 70
- 607
- 592
301
votes
5 answers
Setting and getting Windows environment variables from the command prompt?
I want to set an environment variable from the command prompt and then be able to access it globally (for instance, I should see it by going to System -> Environment Variables).
When I use the set command, it isn't accessible in a new cmd…
![](../../users/profiles/15794.webp)
Shane
- 3,600
- 5
- 21
- 18
288
votes
5 answers
Is there a list of Windows special directories/shortcuts (like %TEMP%)?
I'm looking for a reference list of shortcuts like %TEMP%.
When I'm using Windows+R or Windows Explorer and type %temp%, the Windows Explorer takes me to the Temp directory. Are there more of these shortcuts?
UPDATE:
I found a helpful reference page…
![](../../users/profiles/11141.webp)
rdkleine
- 3,170
- 4
- 18
- 13
256
votes
6 answers
Choosing between .bashrc, .profile, .bash_profile, etc
This is embarrassing, but after many years of using POSIX systems full time, I still have a hard time figuring out if a shell customization should go in .bashrc, .profile, or somewhere else. Not to mention some of the OS-specific config files like…
![](../../users/profiles/15389.webp)
Avdi
- 2,740
- 3
- 16
- 13
225
votes
2 answers
How to reload /etc/environment without rebooting?
/etc/environment is officially the correct place for system wide environment variables. But how can I reload the assignments in this file without rebooting or relogging?
Interestingly enough google does not help me here, aside from the dozens of…
![](../../users/profiles/29387.webp)
fgysin
- 2,898
- 3
- 21
- 17
144
votes
11 answers
When ssh'ing, how can I set an environment variable on the server that changes from session to session?
When I ssh into a server, how can I pass an environment variable from the client to the server? This environment variable changes between different invocations of ssh so I don't want to overwrite $HOME/.ssh2/environment every time I do an ssh call.…
![](../../users/profiles/11622.webp)
Ross Rogers
- 4,427
- 8
- 32
- 43
139
votes
4 answers
Change environment variables as standard user
When clicking on "Advanced system settings", I need to login as the administrator and hence only edit the administrators environment variables (in addition to the machine wide ones). How do I edit the environment variables of a standard…
![](../../users/profiles/4913.webp)
SealedSun
- 2,129
- 3
- 18
- 18
122
votes
4 answers
What is the difference between SETX and SET in environment variables in Windows
What is the difference between SETX and SET?
As per my understanding:
Both are used to set environment variables
SETX is for user variables.
SET is for shell variables.
![](../../users/profiles/294054.webp)
Premraj
- 2,116
- 2
- 18
- 25
108
votes
4 answers
'less' command clearing screen upon exit - how to switch it off?
How to force the less program to not clear the screen upon exit?
I'd like it to behave like git log command:
it leaves the recently seen page on screen upon exiting
it does not exit the less even if the content fits on one screen (try git log…
![](../../users/profiles/20912.webp)
Wojciech Kaczmarek
- 1,332
- 2
- 9
- 11
97
votes
4 answers
Windows 7's PATH and environment variables are corrupted
I have no clue, but lately I've been having this problem. After running my workstation suddenly something destroys PATH and lots of stuff stops working. Initially, my path had MANY directories listed (I use Windows 7 as a development box) and after…
![](../../users/profiles/104745.webp)
Pavel P
- 1,948
- 2
- 18
- 24
95
votes
11 answers
Overcoming the 1024 character limit with setx
I am trying to set environment variables using the setx command, such as follows
setx PATH "f:\common tools\git\bin;f:\common
tools\python\app;f:\common tools\python\app\scripts;f:\common
…
![](../../users/profiles/57735.webp)
Madhur Ahuja
- 1,899
- 5
- 21
- 26
91
votes
4 answers
Difference between "a=b" and "export a=b" in bash
What's the difference between:
a=b
and
export a=b
In bash?
I understand that they both define environment variables, but I don't fully understand the difference.
![](../../users/profiles/2568.webp)
Adam Matan
- 8,090
- 17
- 59
- 84
67
votes
3 answers
How to include environment variable in bash line CURL?
Trying to get Transmission to notify when download complete.
This works:
curl -u : \
-X POST https://api.pushbullet.com/v2/pushes \
--header 'Content-Type: application/json' \
--data-binary '{"type": "note", "title":…
![](../../users/profiles/64606.webp)
Dan
- 2,240
- 4
- 36
- 43
61
votes
2 answers
Path Environment Variable Windows 10. Echo %Path% on command prompt shows only %Path%
My variable value in path is as follows
C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program…
![](../../users/profiles/736007.webp)
Arun S
- 719
- 1
- 5
- 3