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

44
votes
2answers
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 ...
1
vote
0answers
9 views

php is not recognized as an internal or external command although it is available in commandline

this is somewhat of a tricky question when it comes to "where should I place it?", but I assume a general problem behind it, which is why I am putting it on superUser. I have a Doctrine script which ...
1
vote
3answers
2k views

How can I store encfs6.xml in another location (and still make it detectable)?

How can I make encfs4win search for the encfs6 file in another location? I tried modifying the encfs_mount.cmd file at the end, like so: set ENCFS6_CONFIG=c:/test1/.encfs6.xml %pathtoencfs%encfs ...
0
votes
2answers
3k 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 ...
0
votes
1answer
21 views

Assigning a Windows environment variable to a batch variable?

I can't seem to assign an environment variable to another one inside a batch script. For example, this will work: set varA=C:\this\is\a\directory and I can happily use find /I "MyString" %varA% ...
0
votes
2answers
31 views

CMD doesn't update environment variables even when restarting the OS

I've been setup my variables for my development environment using the Windows cmd, but it works well only the first time I set them with the System>Advanced>Env Vars dialog. I just restart cmd and it ...
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
0answers
4 views

Display variable for headless machine to avoid display errors

I'm running some Python programs on a compute cluster. A package I'm using is still in development and isn't very friendly for real work environments...such as the use of: import matplotlib.pyplot ...
1
vote
2answers
28 views

What's the Ideal Way to Swap Entries in the $PATH environment variable?

In Linux and/or Mac OSX, what is the best way to automate moving an entry in the $PATH environment variable to the front of the value like this: /foo/bar:/one/two/three:/opt/local/bin:/home/user/bin ...
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 ...
5
votes
3answers
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
1answer
25 views

How to access Java JARs through CLASSPATH environment variable on Windows 7

I know there is this article on JAR files on Linux but the solution involves some Linux specific commands I don't know, and ultimately I'd like to understand if I can access my JAR (and JARs it ...
0
votes
1answer
234 views

How can I run a command as a different user while Fedora boots up?

I have a server which runs Fedora 19. When the server boots up, I need to run bunch of commands. I do this in /etc/rc.d/rc.local file. This works well. Now I need to start my nodejs server from this ...
2
votes
2answers
2k views

sudo, runuser, su don't work as I expect when run as root with command as “echo $HOME”

When I run these commands it outputs as shown. /root $ sudo -u someuser -i "echo $HOME" /root $ runuser -l someuser -c "echo $HOME" /root $ su - someuser -c "echo $HOME" /root What i expected ...
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 ...
-1
votes
1answer
24 views

Export windows Environment variables to a file. [duplicate]

Can we write a batch file to export all or some environment variables to a file in windos 7?
0
votes
1answer
202 views

How to a sudo command which keeps all environment variables

Example command is as follows, run as a normal user which python /home/me/env/development/python because the PATH environment contains a path that points out to this instance of python (instead to ...
1
vote
1answer
22 views

How does a process change the environment variable of its parent process?

Take cd as an example. Also, it is cd that reminds me of this question. When we input "cd" and press enter on a terminal, a cd child process of the terminal starts and in my mind all things about cd ...
2
votes
2answers
3k 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 ...
5
votes
1answer
46 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 ...
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 ...
-1
votes
1answer
45 views

alternatives to insecure sudo?

How do I protect my environment from sudo erasing half of it? It seems I can protect variables, but functions that the variables (like the prompt, for example) rely on are undefined. This means that ...
0
votes
2answers
72 views

Inform the User when a specific file updates or changes (SOLVED)

The other day I tried to make a batch file that will tell the user the Contest of a file when a specific text file updates/changes here's my code so far it doesn't work for some reason :S @echo ...
0
votes
0answers
6 views

Is it possible to set environment variables in a DE-agnostic manner in X11?

For an example, to set environment variables in Xfce4, I would copy /etc/xdg/xfce4/ to .config/xfce4/xinitrc and add export BLAHBLAH="xyz" in there, but that won't work on Gnome, or KDE, or LXDM, or ...
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
1answer
408 views

Set enviroment variable setx

I am setting a environment variable with setx(win7) in a cmd , that I started from a batch file, if I close the shell an open a new from batch file again and use Set command to check it, I do not get ...
-1
votes
0answers
23 views

Debian /etc/environment variables being overwritten/replaced by another process

I recently "had" to upgrade to Debian Jessie from a 7.6 Wheezy XFCE live install image i setup on my workstation. Pretty much everything is running smoothly with one very odd and quite frankly very ...
0
votes
0answers
20 views

Inno Setup ChangeEnvironment not working

I am using InnoSetup to create an installer but the Environment is not refreshed after the installation. The user has to restart the computer in order for the Environmental Variable to be refreshed. ...
66
votes
6answers
3k views

Choosing between .bashrc, .profile, .bash_profile, etc [duplicate]

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 ...
1
vote
1answer
97 views

Where is file that saves Environment Variables?

I am a developer and usually do stuff with the PATH variable. However, now there are too much path in it, and using a short textbox of Windows is a pain. Before I happen to jump into a text file, ...
0
votes
0answers
16 views

path setting appears twice in env output

After an OS version upgrade I have the following strange problem: % port MacPorts 2.3.1 ... % sudo -i # port MacPorts 2.3.1 % sudo port sudo: port: command not found Furthermore, if I do it all ...
0
votes
2answers
7k views

How do I add an environment variable so I can run an EXE from any folder in the Windows command line?

I went to Environment Variables in the Advanced tab of System Properties and added a new System variable like this: name: msbuild35 value: C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe but ...
1
vote
1answer
37 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 ...
140
votes
7answers
156k 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
2answers
49 views

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

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 ...
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)?
1
vote
1answer
18 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
0answers
23 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 ...
8
votes
4answers
5k 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, ...
0
votes
1answer
21 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
386 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
42 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
26 views

Broken sudo commands

How to repair sudo to use standard commands? I cannot use any command with sudo.
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 ...
0
votes
2answers
776 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
53 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
47 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 ...