Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [environment-variables]

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

0
votes
1answer
14 views

On Windows, why java -version return Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'?

I've removed all ancient java 8 install on my computer. I've downloaded latest openjdk 11 from https://jdk.java.net/11/ and extracted the content to C:\Program Files\Java\ I've setup system ...
0
votes
1answer
31 views

win - python 2.7 & 3.6 - switching version that script uses from shell

I have placed a script test.py in my %USERPROFILE% folder: import sys print("TEST", sys.version_info, sys.executable) When running cmd (WIN+R) and then typing test+ENTER the following is returned: ...
2
votes
1answer
27 views

setting environment variables from command line inside unit files

I am trying to set a date inside the unit file for logging my unit file look like this: [Unit] Description=Jetty service After=multiuser.target [Service] Environment=MAIN_CLASS="com.candorgrc....
0
votes
1answer
32 views

Modifying internally identified username in Windows 8.1

It's easy to change the display username in Windows 8.1, but I can't seem to figure out how to modify the internally identifying username (which can be seen on the Security window, which would say e.g....
0
votes
1answer
17 views

Add environment variable as a startup argument (Windows)

Let's say I have a program called myProgram.exe. I create a shortcut and send it to my desktop. Now I right-click shortcut, and go to properties. I add the argument "-ldir %cd%" to the target. The ...
2
votes
2answers
421 views

Capture specific environment variable from Linux sub-shell

I am trying to figure out a way to run a shell script B from script A, set or export a variable in script B, and be able to store that value in script A after script B finishes and its sub-shell ...
1
vote
0answers
23 views

Environment variables (e.g. %PATH%) expansion rules, etc [closed]

I'm trying to get a handle on how you know if an expandable string will be properly expanded in a user's Path environment variable. As there appears to be a lack of proper documentation on the MS ...
2
votes
0answers
45 views

Windows 10 Deleted system environment variables keep coming back

I've been using GNU Emacs on Windows for many years and in order to make it work, I've always had to define several environment variables. I've had these defined as system variables all this time: ...
0
votes
1answer
79 views

Powershell: dynamic variables within foreach

I am trying to do some math for a dynamic list of users that I will use to run a search and count some results anonymously, then add to a running total per user. So, for instance: $users = Get-...
0
votes
1answer
77 views

What is the recommended way of managing environment variables in Unix systems? [closed]

I have always been thinking about the effective way of managing environment variables in operating systems like Ubuntu, macOS, etc.. I have a couple of questions related to it. Is there a common ...
0
votes
0answers
17 views

How to end environment variables [duplicate]

How do I end environment variable declaration? For eg: SET REACT_APP_API_HOST=tun-tunak-tun react-scripts start Here the text tun-tunak-tun react-scripts start is entirely treated as variable's ...
0
votes
1answer
50 views

Is there a way to permanently set a environment variable with more than 4096 characters on Window OS?

I'm currently searching for a way to overcome the limit off the environment variable length on Window OS, and the maximum limit I have achieved is 4133. But for my project, I need to check the system ...
4
votes
2answers
604 views

How do I check if the three last characters of a variable match another variable?

I have %var1% and %var2% var1="UserInput" var2=file.log If a user types %var1% as "file.txt", how can I (if possible) check only the three last characters (Or the file format if that's possible) to ...
0
votes
1answer
58 views

How to add variable to PATH system variable? [duplicate]

I am trying to add to my Windows 10 a new folder to my existing PATH system variable. But I'd like to add it as a nested variable. So what I did was: Create a variable for my folder as a system ...
0
votes
0answers
16 views

wingnu32 env tool does not print variable

I found the tip to use the wingnu32 tool env from , which is installed on my Windows 10 device anyway, as Git and Docker are installed. However, I don't get it working as wished. It behaves as ...
0
votes
1answer
112 views

Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set

When I try to create my project's Javadoc in IntelliJ IDEA using Maven, the following error appears: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc (...
15
votes
1answer
3k views

I changed my “HOME” variable and now cannot find “~/.bash_profile” to change it back

I was messing around with environment variables on my Mac, trying to learn how to use them and I used the command nano ~/.bash_profile where I then added the line HOME=/Users/MyCompName/Desktop to ...
0
votes
0answers
25 views

changing the environment to start a software

I have downloaded a software and want to change the environment of my computer such that when I write the name of the software, the downloaded software opens. The download directory is: /home/abc/...
0
votes
1answer
82 views

Editing System Environment Variables is allowed only when opened through Control Panel

On Windows 10, if I open the Environment Variables window directly through Windows Search, I can't edit the System Variables (buttons are disabled): However, opening it through Control Panel (Control ...
0
votes
0answers
13 views

Problems Setting Environment Variable on Ubuntu | Ruby on Rails

I have tried to set my environment variables multiple ways on my Ubuntu server but nothing seems to work. I need to know how to properly set them on the digital ocean droplet I am using to host my ...
0
votes
0answers
40 views

Command prompt. Is it possible to create a certain number of variables according to the lines in a text file and then

Can we use a text file to set variables according to how many changing lines are there in the .txt file? files.txt name 1 text 2 info 3 ... and so on set line01="name 1" set line02="text 2" ...
1
vote
1answer
9 views

Setenv list edit Centos 5.11

Been looking for an answer but nothing seems to give me a simple one-liner answer (I am not a computer genius). I want to edit one of the variables (I see them with setenv commant) on a centos 5.11 ...
0
votes
0answers
19 views

How to command line `cd` into directory on other drive by using Environment Variable? [duplicate]

I want to use Windows CMD or PS I want to execute this command: C:\Users\myusername>cd %MYSPECIALENV% In System Variables MYSPECIALENV variable points to D:\SomeDir\SomeOtherDir (Other Drive!) I ...
0
votes
0answers
14 views

Using ENV vars in IntelliJ IDEA

I'm using IntelliJ IDEA in Windows 10. I'm trying to set up an application-specific login credential set without hard-coding it into a YAML file. This project will eventually be pushed to github and ...
0
votes
1answer
80 views

How to set Base64 encryption key as Environment (system) Variable on Windows 10

I have an application that connects to BigQuery using multiple creds from .json file. Being that this app will eventually reside on Pivotal Cloud Foundry and will need to be set as User Provided ...
1
vote
1answer
148 views

The function of the %configsetroot% system variable in Windows

When I checked my PC, the %configsetroot% system variable was set to the path: %SystemRoot%\ConfigSetRoot But the weird thing is that the directory as indicated by that path doesn't exist. The ...
0
votes
0answers
17 views

Batch script is unable to read Windows environment variables if windows agent is running over SSH from linux master Jenkins

I have setup Jenkins master on linux, and agent on windows 7 using SSH. But when my jenkins job is invoking batch scripts present on windows agent, it's unable to get %LOCALAPPDATA%, %USERPROFILE% and ...
0
votes
0answers
14 views

Add environment variable to internet explorer shortcut

As seen in the image below, I would like %username% to be replaced with the username of that current computer user. Is such a thing possible? If not would it be possible with a bash script somehow?
1
vote
1answer
18 views

How can I store a Powershell variable's value as a string while creating ISE submenus

I can't seem to articulate my issue well enough within the search engines to find the answer I'm looking for, so I turn to the community for help: I want to populate my Powershell ISE's menu with ...
33
votes
5answers
3k views

Does the Windows Command Prompt search somewhere other than those locations specified by the PATH variable when launching application programs?

I tried the following experiment. Before I start, I checked the PATH variable from cmd, which has the following value: Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS ...
0
votes
0answers
21 views

Unable to use environment variables in setting other environment variables in Windows 10

In the environment variable window in Windows 10, I set FOO_VAR=foo BAR_VAR=%FOO_VAR%bar I would expect that echo %BAR_VAR% shows "foobar" but %FOO_VAR% in BAR_VAR doesn't get resolved. Is this ...
0
votes
0answers
75 views

Switch-user causes change of TEMP variable of the exprorer.exe

I have Windows 7 Pro x64 with latest patches. Though it may sound unbelievable, sometimes, the environment variables TEMP and TMP of my explorer.exe process - seemingly out of nothing - change their ...
0
votes
1answer
113 views

Environment variables only work if I launch the application from terminal

I recently got a MacBook and I'm doing some programming with Eclipse. I need to use Amazon S3, so I needed to set my credentials as environment variables. I typed vim ~/bash_profile and added the ...
0
votes
1answer
144 views

Search and replace environment variable's value via batch file?

I want to create a batch file to quickly switch a PATH variable in order to be able to work in a different environment, and then another to restore it. I assume that it would be done via setx and some ...
0
votes
1answer
35 views

if -else in shell script, matching argument with string

For the following shell script - #!/bin/sh main_version=0 feature_version=0 patch_version=0 if [[ $1 -eq "m" ]]; then main_version=$((main_version+1)) fi if [[ $1 -eq "f" ]]; then ...
0
votes
1answer
13 views

How to use variable in variable in bash?

I have two variables - regex="<version>[0-9]*\.[0-9]*\.[0-9]*[^<]*<\/version>" updated_regex="<version>${main_version}\.${feature_version}\.${patch_version}${tag}<\/version&...
0
votes
1answer
27 views

Want to set an environment variable with TIME /t

I want to set a Windows environment variable from the results of TIME /t. In Windows, the %time% variable yields one format (13:17:52.79), whereas TIME /t has another (01:17 PM). I've tried ...
0
votes
1answer
52 views

Create Percentage Sign Variable to use in Environment Variables

In Windows 10, some environment variables actually use percentage signs to refer to paths. For example, the PSModulePath environment variable looks like this (ignore the additional one I marked out): ...
2
votes
2answers
648 views

Set PSModulePath Environment Variable with PowerShell in Windows 10

I don't understand this. So currently my system environment variable named "PSModulePath" looks like this: %ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\...
1
vote
1answer
50 views

Unix/Linux - service unit file cannot recognize env variable set in /etc/environment

I have an environment variable setup correctly in /etc/environment I have ensured that it loads correctly via /etc/profile modification. and I can echo it to confirm. but when I created the unit ...
0
votes
0answers
958 views

Windows 10 environment variable PATH not getting updated

Inspired by the following video link : https://www.youtube.com/watch?v=JQ58d3BEV_8 I tried to change the PATH variable of my system and add the path that has been mentioned there . Ii have a ...
0
votes
1answer
136 views

pip command error during installation of requirements.txt

When I run the command py -2.7 -m pip install requirements.txt, I'm getting the error but I have already upgraded it but I'm still getting error in installing requirements.txt. When I use the ...
1
vote
1answer
2k views

Setting an environment variable in Windows 10: gPodder

I have just installed the podcast client gPodder (https://gpodder.github.io/). I am trying to change the default download directory, and the manual indicates that you set the environment variable ...
0
votes
0answers
174 views

Registering an Application to Custom URI Scheme with environment variable

I'm following the guide here on Microsoft's site to register an application to a custom URI scheme. This works if I can provide a static path to the executable to run shell open command ...
0
votes
0answers
22 views

Where does $HOME variable comes from and why I can't change it? [duplicate]

I know this is stupid, but last 30 minutes I am trying to change $HOME variable to other value, doing $Env:HOME = "desired value" did nothing for me, I tried couple other suggestions from the first 10 ...
1
vote
1answer
33 views

Add ~/projects/*/bin directory in environment PATH (Ubuntu 16.04)

Everything is in the title. I know how to add new path in the environment PATH variable but I would like to make it recursive by automatically adding /bin folders of all my future projects. Something ...
1
vote
1answer
93 views

Batch file not returning correct value after using bat to exe

I'm having lots of issues with this script. It's supposed to read the a file (that the user specifies) then save it to the storeresult environment variable. I'm using a BAT To EXE converter that ...
2
votes
0answers
169 views

Globally set environment variables for gpg-agent in MacOS High Sierra

I want to use gpg-agent instead of ssh-agent in MacOS High Sierra. To achieve this I need to set globally two environment variables: GPG_TTY=$(tty) SSH_AUTH_SOCK=${HOME}/.gnupg/S.gpg-agent.ssh This ...
0
votes
0answers
46 views

How to get values, log into server and run commands using PuTTY with the values

I am trying to create an automated (batch) script (i.e., for Windows) to collect hostname and instance name (SID), open PuTTY using my username/password & host to login into the server and issue ...
0
votes
1answer
82 views

How to override environment path variable to call curl from custom path instead of system32 path?

I have a path for folder containing curl.exe file (C:\My\Custom\Directory\) added to Path Environment Variable. The problem is that when I call curl from command line, it runs another curl executable ...