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

136
votes
7answers
148k 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
25 views

Batch script to take the output of a command and create a variable out of it?

For example, I want to search for a file where /r C:\ "myfile.txt" and then make the output of that command which would be the file path to "myfile.txt" a variable I choose, So then the path to ...
0
votes
2answers
27 views

Accidently deleted PATH environment variable - how do I get it back?

I had to add the JDK path in the system variables which is under environment variables, but by mistake I deleted the default path which was present in the Path and pasted the JDK path. So how do I ...
3
votes
0answers
25 views

How to determine whether a folder in %PATH% is required in Windows 7

How can I determine whether a particular folder in the PATH environment variable is used by the system? Recently, some software that relied on the system PATH stopped working b/c another package ...
7
votes
5answers
4k 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)?
1
vote
1answer
15 views

Why does 'export foo=1' not get read when I use ssh?

I'm trying to set a remote environment variable explicitly in an ssh command: ssh worker-2 "export OPENBLAS_NUM_THREADS=1; echo $OPENBLAS_NUM_THREADS" Strangely, this prints just a blank line, but ...
0
votes
2answers
2k views

Setting environment variables and appending to system-wide %PATH% with a Windows batch file

I'm trying to set three environment variables and append them to the machine path. Right now my code is like this: setx CATALINA_HOME "C:\Program Files (x86)\Apache Software Foundation\Tomcat 7" /m ...
-1
votes
0answers
21 views

Deleted environment variables [on hold]

I think I deleted some environment variables by mistake, how can i restore them without losing my computer's data (files) ?
0
votes
0answers
19 views

enviroment variable %PROGRAMFILES% with 2 executions

I want to install a program with a batch-file to the Program Files folder. Afterwards I want to copy a folder to the same folder. Here is an example: SET SCRIPT_LOCATION=%~dp0 SET ...
1
vote
1answer
2k views

APPDATA and LOCALAPPDATA environment variables are not set on a profile in Windows 7 Pro 32bit

I am having problem with a user account on a Windows 7 machine (local install, admin user account) APPDATA and LOCALAPPDATA environment are not set. Another user on the same machine, (also a local ...
7
votes
4answers
4k views

Why won't my Windows 8 Command line update its path

I needed to add a new entry to my PATH variable. This is a common activity for me in my job, but I've recently started using Windows 8. I assumed the process would be similar to Windows 7, Vista, ...
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 ...
0
votes
1answer
17 views

crontab and binaries in /usr/local/bin

I am working in Redhat and have few programs located in folder /usr/local/bin I would like to call from crontab for root user. I thought that by putting binaries in that folder would be sufficient to ...
3
votes
2answers
369 views

How to capture session name into tmux variable?

I want to execute an external command based on the value of my session name. I know that the :display-message '#S' will give me the session name, but I want to have that name automatically sent to my ...
0
votes
2answers
24 views

Setting environmental variables for apache user www-data

I want to set the environmental variable GNUPGHOME=/path/to/home for the apache user www-data. I tried setting GNUPGHOME inside /etc/profile with if [ "`id -u`" -eq 33 ]; then export ...
0
votes
0answers
24 views

Broken sudo commands

How to repair sudo to use standard commands? I cannot use any command with sudo.
0
votes
2answers
2k views

Add a directory and all subdirectories to the PATH variable with a single entry

I've got a directory in my home folder in which I place command-line software (CMD_Software). I put each piece of software in its own directory within CMD_Software in order to avoid clutter. I would ...
30
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 ...
0
votes
2answers
700 views

Command prompt cannot find PATH variable

Sometimes, my command prompt cannot find the PATH variable. I have this occasional problem at work where when I open command-prompt and run commands like ipconfig or subst, I get an error saying ...
2
votes
0answers
39 views

Task Scheduler program writes to literal folder named %LOCALAPPDATA%

I have a .NET executable (that I created) which uses Microsoft's Active Directory Service Interfaces (via System.DirectoryServices.AccountManagement) to do LDAP queries. Internally to ADSI, it ...
0
votes
2answers
42 views

Two environment variables with the same name

I tried adding an 'Environment variable' with the name "PATH" but I found another entry with the same name. can I change the old one to a different name? I tried openning "GPAC" folder, but didn't ...
3
votes
4answers
3k views

Irssi settings and Bash's Environment variables

How can I define settings, such as ircname, nick and such things, in .bashrc for Irssi?
2
votes
0answers
32 views

Windows: Execute program as admin with current environment and with elevation [duplicate]

This question is different from Run as administrator from command line on Windows 8 and I wrote why: I want to run a program a) as a different user b) get elevated privileges (which is additionally ...
0
votes
1answer
25 views

Win7 loses PATH from user profile

Recently, a very weird thing started to happen that has not happened before: Suddenly, from out of nothing Windows 7 & "forgets" the part from PATH from the user profile. As can be seen on the ...
2
votes
3answers
2k views

set user's PATH variable without admin access in XP

I have two related questions for XP variables; it may end up the same method works for both of them. I as a user want to modify my Path but lack the admin rights necessary to change it. I imagine ...
2
votes
2answers
2k views

Setting proxy via http_proxy on Mac

I am using an HTTP proxy on MacOS 10.7 (which works for Safari.app, when set in the system preferences). I'm now trying to set the proxy for command-line applications using the $http_proxy environment ...
44
votes
1answer
77k 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 ...
-1
votes
1answer
32 views

Using /usr/bin/env to change directory [closed]

I want to automatically execute commands with the prefix /usr/bin/env $/usr/bin/env composer install (this runs OK) $/usr/bin/env cd public (failed ---> /usr/bin/env: cd: No such file or ...
0
votes
1answer
14 views

Using Environment Variables in an AD Profile Path

When I set a profile in an AD object, I need to use a predefined environment variable, %BUILDID%. So the path would be \SVR-STAFF\Profiles$\%BUILDID%\Administrator.v2 ... But the path doesn't work. ...
0
votes
1answer
30 views

How to set R environment variables on Linux

I call a r script from PHP and it works well. I just call it using this function shell_exec("Rscript play.r"); To do that I had to make setting in environment variables in Windows to the R ...
0
votes
1answer
51 views

How to call a Windows Environment Variable in a Shell script?

It is possible to call Windows Environment Variables in a bat script by defining e.g. %JAVA_HOME%. It looks like this is not possible using CygWin and shell scripts. Is it possible to call Windows ...
0
votes
3answers
622 views

How to set the arithmetic precision in “set” batch files variables?

How do I set a precision to the SET arithmetic operation on divisions? eg. SET /A t=3/4 But that gives result as '0' and not '0.75' ( I want at least 2 decimal places ) Or is there any other ...
0
votes
1answer
41 views

How to remove path from PATH variable in fish

I am using fish as my shell in Debian and recently (after some upgrade) whenever I try to use command completion I have: set: No such file or directory set: Could not add component ...
71
votes
4answers
156k 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 ...
0
votes
1answer
43 views

Windows 8 'setx' is not recognized as an internal or external command

I'm trying to edit an environment variable, but i'm getting an error that 'setx' is not recognized as an internal or external command, operable program or batch file. I can use the set command, but ...
1
vote
3answers
2k views

Term Enviroment Variable not set, when executing a Bash File via SSH

i am trying to run a bash script on a remote machine. If I open a ssh connection in a terminal, i can easily run the script. But when i run it like that: ssh user@ip < /etc/script I get an ...
0
votes
3answers
96 views

Win7 resets HKCU/Environment/Temp and TMP on login

I once had a fresh installation of Win7 on an SSD drive. Bearing in mind what you always hear about write cycles on these things, first thing I did was changing the TEMP/TMP variables of SYSTEM and my ...
-1
votes
1answer
30 views

I don't see 'path' under environment vaariables

I am trying to set path for Python but I have no 'path' under environment variables. Below is a link for the original issue as well a screen shot. How can I fix this?
0
votes
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 ...
0
votes
1answer
67 views

Environment Variable ORACLE_UNQNAME not defined

I'm trying to install Oracle 11gR2 Entreprise Edition but during database creation, I got this Error : Environment Variable ORACLE_UNQNAME not defined And when I tried to lunch 'emctl.bat' From ...
12
votes
3answers
15k views

How do I see a list of all currently defined environment variables in a Linux bash terminal?

In a Linux bash terminal, there are often many environment variables that have been set, like $PATH and $HOME. Is it possible to see all of the environment variables that have been set? How?
0
votes
0answers
26 views

'MSIEXEC' is not recognized as an internal or external command

The system programs are not working on my WIN7 64bit system (CMD, PING, MSIEXEC, IPCONFIG, etc). Steps I've taken: %SystemRoot%\System32; is listed in the Environment Variable Path. At command ...
5
votes
2answers
5k views

Refresh environment variable

How can I refresh a Windows cmd shell after I modified my Environment variables? i.e. in bash I can just do "source ~/.bashrc"
0
votes
0answers
42 views

Is it possible to set my PATH variable in a desktop entry?

I've created a bin directory in $HOME with shell scripts that are each set up to load a Firefox profile; this way I can use a simple command like e.g. facebook to open a Firefox profile reserved for ...
0
votes
1answer
16 views

How do I unset “!::” environmental variable in bash?

I have a build script that is failing because it tries to unset an environmental variable called !::. That fails: $ unset -v '!::' sh: unset: `!::': not a valid identifier How do I unset that ...
0
votes
1answer
23 views

exporting bash paths with same variable name

I'm looking at my bash profile and not really understanding what I see. I think I see a variable (PATH) being redeclared - though this can't be true as all my programs seem to work. Can you help me by ...
2
votes
7answers
26k 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; ...
0
votes
0answers
84 views

Problems installing postgresql-9.3.4-4-windows-64 on windows 7

I am trying to install postgresql-9.3.4-4-windows-64 on Windows 7 x64 and keep getting the error message: Error. There has been an error. Unable to write inside TEMP environment variable path. ...
2
votes
2answers
101 views

Issue with environment variable

Please help me running below command from user2 account. I cannot figure out what's the issue with this. [user2@localhost bin]# sudo -u user1 /opt/Tomcat/bin/shutdown.sh Neither the JAVA_HOME nor the ...
5
votes
2answers
293 views

Any quick way to call a directory using an environment variable in Powershell

Say I have a user environment variable named p and it's value is the path where I store my projects. In Command Prompt you can use them to quickly access a particular directory from anywhere on the ...