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

139
votes
7answers
155k 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 ...
44
votes
1answer
82k 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 ...
13
votes
2answers
12k 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 ...
0
votes
1answer
212 views

Forcing programs to be installed to another drive

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 ...
14
votes
9answers
5k 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 ...
4
votes
2answers
20k 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 ...
23
votes
3answers
42k 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 ...
10
votes
5answers
6k 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
5k 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
12k 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 ...
8
votes
2answers
5k 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
6k 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 ...
16
votes
13answers
26k 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 ...
10
votes
1answer
10k 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
7k 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 ...
24
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.
3
votes
1answer
3k 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 ...
9
votes
5answers
40k 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 ...
7
votes
3answers
7k 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
3answers
3k 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 ...
4
votes
2answers
2k 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 ...
4
votes
6answers
15k 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?
2
votes
1answer
6k 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 ...
2
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
313 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
580 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 ...
36
votes
3answers
44k 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 ...
57
votes
4answers
62k 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 ...
75
votes
4answers
167k 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 ...
20
votes
4answers
17k 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 ...
32
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 ...
8
votes
4answers
6k 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
7k 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
8k 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
4answers
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?
3
votes
7answers
27k 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; ...
16
votes
2answers
24k 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
2answers
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 ...
3
votes
2answers
1k 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
781 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 ...
2
votes
2answers
353 views

Is it safe to store critical passwords in server environment variables?

I have a cluster of servers, each with configuration files that currently contain plain-text passwords for sensitive, mission-critical systems (message queues, data stores, and other services). Some ...
2
votes
2answers
140 views

Unable to get profile variable using ssh

Unable to retrieve the profile variable using ssh. server2 ==> user apptst ==> bash profile has $APPHOME variable. Was trying to retrieve the value from server1 using ssh but failed. Used options ...
2
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 ...
1
vote
1answer
2k views

I overwrote my environment variable PATH

I've accidentally overwritten the environment variable PATH in Windows 8 (64 bit). How can I reset it? I'm scared to shut down the PC before fixing this problem. Otherwise I might copy it from ...
1
vote
1answer
608 views

Setting user environment variables is very slow

I'm using the GitHub for Windows application. Lately I've noticed that starting a PowerShell console from within the GitHub application takes ages. After some digging I've found that the slow command ...
6
votes
2answers
8k views

How do I append user-defined environment variables to the system variable PATH in Windows 7?

I have two user defined variables: ANT_HOME set to %USERPROFILE%\Developer\Tools\Apache\Apache Ant\apache-ant-1.8.2 JAVA_HOME set to C:\Program Files\Java\jdk1.6.0_23 And I want append ...