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

learn more… | top users | synonyms

156
votes
7answers
176k views

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 ...
0
votes
1answer
854 views

Forcing programs to be installed to another drive [duplicate]

I have an SSD as my main Windows drive, with a 640GB 2.5" HDD, partitioned to store programs and user settings, and also to act as backup (it's the only thing I had lying around at the time of ...
50
votes
2answers
98k views

Setting and getting windows environment variables from the command prompt?

This is a very basic question, but I can't find an answer. 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 ...
15
votes
2answers
16k views

How to extract environment variables from system restore point, Windows 7 64-bit

Recently a (badly written) piece of software erased my PATH variable. I've been installing software for years and recovering every single entry would be cumbersome. An even more cumbersome solution ...
19
votes
13answers
30k views

Why can't Windows handle an environment variable in Path?

My colleague and I have identical Dell workstations with Windows XP Professional x64 edition installed. My Path environment variable starts with: %JAVA_HOME%\bin;... My colleague's Path variable ...
39
votes
3answers
50k views

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 ...
14
votes
9answers
6k views

Is there any command line tool that can be used to edit environment variables in Windows?

Is there any command line tool that can be used to edit environment variables in Windows? It would be nice if this was smart tool, for example: When adding some path to let's say the PATH variable ...
6
votes
2answers
24k views

How do I reset the $PATH variable on Mac OS X?

I've messed up my path variable, and now some apps that I run raise errors saying Command Not Found (error 127) for commands like date and sleep. These commands work fine when executed directly in the ...
3
votes
1answer
4k views

Is there a way to set Windows environment variables from the command line PERMANENTLY [duplicate]

Possible Duplicate: Setting and getting windows environment variables from the command prompt? Is there any way to set permanently set an environment variable system wide from the command ...
27
votes
3answers
48k views

How do I make sudo preserve my environment variables?

Using sudo 1.7.4p4 on Solaris 5.10 and sudo 1.6.7p5 on RHEL4 u6 I can't see how to preserve my environment variables, for instance $PYTHONPATH. I've added this line to sudoers, but it doesn't make any ...
12
votes
5answers
7k views

Adding an .exe to default path without adding the directory

For example, I want to add notepad++ to my PATH, however the directory also contains uninstall.exe and several other files/executables and I don't want them to "pollute" my path. Can I just add the ...
7
votes
5answers
6k views

Setting environment variables in OS X for GUI applications

How does one set up environment variables in Mac OS X such that they are available for GUI applications without using ~/.MacOSX/environment.plist or Login Hooks (since these are deprecated)?
6
votes
1answer
13k views

Set Permanent Environmental Variable in Windows XP

I want to set environmental variables permanently through a batch file. Is there a command to set Permanent Environmental Variable (other than SETX) for Windows XP service pack 3? command SETX ...
6
votes
3answers
4k views

Wrong java -version being reported

I am running Windows 7 Professional x64 and have the following Java versions installed: x64 C:\Program Files\Java jdk1.6.0_24 jdk1.7.0_04 jdk1.7.0_07 jre6 jre7 x86 C:\Program Files (x86)\Java ...
8
votes
2answers
6k views

.profile or .bash_profile

I'm confused, where do I set environmental variables? In .profile or in .bash_profile? I am using both mac osx and ubuntu. Confused as to which one I use here.
1
vote
1answer
10k views

Recover accidentally deleted Path environment variable

I use a Windows 7 x64. I just accidentally deleted my user path environment variable and was trying to recover it. I'm glad I found what I really need here. But I don't understand what exactly ...
29
votes
4answers
2k views

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.
10
votes
1answer
12k views

How can I permanently append an entry into the system's PATH variable, via command line?

What I need to do: Append a folder to the %PATH% environment variable at the SYSTEM level. Make the change permanent. How I need to do it: Using the command prompt, or another method by which ...
10
votes
1answer
8k views

How can I set environment variables for a remote rsync process?

When I use rsync to copy files from one computer to another, an rsync process is started on both ends. However, on the remote end, shell initialization files are apparently not read, so I cannot set ...
10
votes
5answers
43k views

Different PATH environment variable for 32bit and 64bit Windows - is it possible?

Is it possible to have whole or part of PATH environment variable specific to the type of running process's image (32bit/64bit)? When I run some app from within 64bit cmd.exe I would like to have it ...
4
votes
5answers
5k views

Spawn a new terminal window (Mac OS X)?

I am often working in a process in the Terminal and I've set some variables and used cd and so forth. Then I'd like to open another Terminal window from there. Is there any way to do this?
8
votes
3answers
8k views

adding PATH with SETX or PATHMAN or something else?

I am trying to add a PATH from command line, as with SETX %PATH%... it always expands the PATH, which I don't want. PATHMAN is exactly for this purpose, but it doesn't work for me on Windows 7. It ...
5
votes
2answers
4k views

How to update the PATH user environment variable from command-line

I have a system PATH variable with the system level config. I use the user PATH variable to complement the PATH with user-specific config. I would like to update the user PATH variable from ...
4
votes
3answers
4k views

Setting environment variables Mac 10.6 [duplicate]

Possible Duplicate: What are PATH and other environment variables, and how can I set or use them? How to set an environment variable in Mac OS 10.6. I am finding it difficult or the options ...
2
votes
4answers
2k views

Where is the Official list of Windows Environment Variables?

I'm working on some .bat stuff created in a legacy application, which uses many environment variables. I need to know exactly what is every one of them (%windir%, %os%, etc.). So I need the official ...
4
votes
6answers
16k views

Command line app 'not recognized as internal or external command.'

A few years back I made a couple of console command line apps which at the time worked with no issues. I'd place them in the window/system32 directory and be able to use them from the console prompt ...
4
votes
1answer
4k views

How to export Environment variables to a text file

I want to have a look into my Environment variables as a text file into XP Professional. Is there any way?
3
votes
1answer
7k views

TEMP environment variable occasionally set incorrectly

Occasionally, I find my TEMP and TMP environment variables set to C:\Windows\TEMP. They should be set to %USERPROFILE%\AppData\Local\Temp, and are configured correctly in System Properties. This ...
3
votes
2answers
2k views

Is it safe to change %TEMP% and %TMP% to a custom location?

I have an SSD drive that is nearly full and I'm looking for options to free up space. I noticed C:\Users\myusername\AppData\Local\Temp has several gigs of data. Is it safe to change the User ...
2
votes
1answer
1k views

Setting JAVA_HOME environment variable

I have set java_home on my mac, by putting export JAVA_HOME=/System/Library/Frameworks/JavaVM.frameworks/Home to my ~/.profile file. I quit the terminal and ran it again. But when I typed echo ...
1
vote
1answer
1k views

Access/modify the User path variable, not System path

I am trying to make an installer for a program and my workplace doesn't allow us 'regular' users to modify the system environment. In an effort to get around the restrictions, I'm trying to add my ...
0
votes
2answers
400 views

Can I change the environment on a per-process basis on Windows (like on Unix)?

On Unix operative systems I can start a process with additional environment variables like this: $ DEBUG=1 VERBOSE=3 python myscript.py Does the Windows CMD have an equivalent for this? I'm stuck ...
0
votes
4answers
634 views

Where does OS X save environment variables? [duplicate]

Possible Duplicate: Setting JAVA_HOME environment variable When you type "echo $JAVA_HOME" in Mac, where does Mac look to find the value of JAVA_HOME? In other words where does Mac save ...
64
votes
4answers
68k views

Change environment variables as standard user (Windows 7)

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 ...
99
votes
5answers
216k views

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 ...
25
votes
5answers
20k views

Overriding HOMEDRIVE and HOMEPATH as a Windows 7 user

My employer has an Active Directory group policy which sets my Windows 7 laptop HOMEDRIVE to "M:" (a mapped network drive) and my HOMEPATH to "\". Since I have read-only permissions for the root of ...
16
votes
6answers
14k views

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 ...
12
votes
3answers
10k views

Switching between Java 7 and 8 in OS X

I have installed Java-8. Now I wanted to go back to Java-7 by default so I type in... /usr/libexec/java_home -v 1.7.0_40 --exec java -version /usr/libexec/java_home -v 1.7.0_40 --exec javac -version ...
34
votes
2answers
5k views

'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 ...
9
votes
1answer
4k views

Why unload variables in Windows batch files

Is it considered necessary or good practice to unload variables used in Windows batch files? For example in the following code, is the set myFolder= at the end necessary? @echo off set ...
8
votes
4answers
7k views

Setting Linux environment variables

I am running Red Hat Linux Enterprise 5; I am always using the export command to set environment variables. Are there any other ways to set environment variables and what are the ...
1
vote
3answers
8k views

Editing the /etc/launchd.conf file in OS X

I am trying to run Android project using Maven in Mac 10.7.4, for that I need to set environment and path variables. This are the steps I need to follow to run android using Maven Maven 3.0.3+ ...
4
votes
2answers
9k views

WINDIR environment variable resolves to %SystemRoot% and not C:\windows

Some time ago I manually changed the WINDIR environment variable to test something in a legacy program I was working with (should have done this on a VM rather than my desktop :/ but it's too late ...
4
votes
2answers
2k views

How can I update cygwin shell environment variables set in System Properties window

Suppose I go into the System Properties window and add an environment variable to the Path. If I have a terminal window open, it will be unaware of the change, so I close it and open another one. Is ...
4
votes
7answers
33k views

Spaces and Parenthesis in windows PATH variable screws up batch files

So, my path variable (System->Adv Settings->Env Vars->System->PATH) is set to: C:\Python26\Lib\site-packages\PyQt4\bin; %SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem; ...
17
votes
3answers
26k views

Can I change the PATH environmental variable in Windows 7 without restarting?

Is there anyway to change the PATH environment variable (or variables in general) on Windows 7 Exterprise (64 bit) and have it take effect in PowerShell or the command prompt (cmd.exe) without ...
5
votes
1answer
2k views

Running shortcut from command prompt without the .lnk extension (Windows)

I have created a folder (d:\shortcuts), created shortcuts for most applications in this folder and appended the folder path to the Path environment variable. Now all my applications are available from ...
5
votes
6answers
6k views

Why does my LD_LIBRARY_PATH get unset launching terminal?

I have a shell script to set up some environment variables and launch whatever program I send in as an argument: export PATH=$HOME/local/bin:$PATH export ...
3
votes
2answers
2k views

Transferring environment variable through SSH / quoting in bash/sh/csh/tcsh

I want to transfer an environment variable over SSH. The "correct" way is using SendEnv/~/.ssh/environment, but that requires the server to support AcceptEnv or PermitUserEnvironment, which it does ...
3
votes
1answer
862 views

~/.bashrc not sourced in a new lxterminal window

I added some lines to my ~/.bashrc like export JAVA_HOME=/opt/jdk1.6.0_22 I sourced it: $ source ~/.bashrc $ env | grep 'JAVA' JAVA_HOME=/opt/jdk1.6.0_22 Then I created a basic bash script under ...