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 scripts (they just have to update the environment variable).

Filter by
Sorted by
Tagged with
2 votes
1 answer
159 views

How can I make CMD load normal system commands by default? (command prompt / powershell)

Please see below screenshot, this is pretty much self explanatory. All default programs in System32 aren't being loaded and can't run unless I specify the exact directory and path of the program ...
user avatar
  • 1,284
0 votes
1 answer
17 views

How to store the result of a subquery in a variable in cmd?

Here's my bat file: @echo off for /F "tokens=* delims=," %%a in ('type C:\LocalSecrets\Depolyment.csv ^| findstr "%DomainName%"') do call :parcsv %%a goto :EOF :parcsv echo &...
user avatar
  • 23
0 votes
0 answers
58 views

Have I been backing up worthless APPDATA for years?

deep breath Alright, so I just needed to restore some important data stored in a program's user profile. So naturally, I went to one of my backup disks and navigated to the APPDATA dir. The data was ...
user avatar
0 votes
1 answer
78 views

Setting user PATH environment variable on Windows 10 has no effect

I have a bizarre problem with setting my user PATH variable. C:\Program Files\ghcup\bin is the path to my executable that I want to add to my user PATH. I have tried setx /M path "%PATH%;C:\...
user avatar
  • 3
0 votes
2 answers
23 views

How to find where the variable come from in a bash set command?

It happens I have some unwanted environment variable inside the set command output, and I can't get rid of these: $ set ALL_PROXY=socks://127.0.0.1:10010/ .... (lots of environment variables) ...
user avatar
  • 101
0 votes
1 answer
56 views

WSL2 / wslg Windows Start menu app - where is the $PATH env pulled from?

I've compiled the latest gnu compiler (11.2) on Ubuntu 20.04. In my~/.bashrc , the directory I have gcc/g++ installed in is pathed. Now, I have compiled R in wsl2 using the gcc 11.2 compiler. Then I'...
user avatar
  • 101
0 votes
1 answer
53 views

Run script on windows startup with environment variable

Windows should run a script on startup that starts a DB based on an environment variable %SAPSYSTEMNAME%: net start SYBSQL_%SAPSYSTEMNAME% When i run this command in my cmd it works fine, however on ...
user avatar
0 votes
2 answers
42 views

bash loop trough variables

if i have a bunch of variables in bash: foo_1="path/1" foo_2="path/2" foo_3="path/3" foo_4="path/4" foo_5="path/5" They all start with foo_. Is there ...
user avatar
  • 65
0 votes
1 answer
129 views

ssh commands in cron jobs on remote server

It is known that cron and ssh-agent do not communicate and hence ssh commands cannot be trivially run under cron. There are solutions involving keychain etc that make it possible to do this. However ...
user avatar
0 votes
2 answers
69 views

Erased System Path Variables

I was writing a batch file that was supposed to automatically set up a computer to receive "psexec" remote commads. Unluckly i didn't really pay attention to what i was writing and i wrote ...
user avatar
  • 1
0 votes
2 answers
72 views

Assign result of conditional expression to environment variable

I'd like to store the result of a conditional expression in an environment variable. I tried: C=$([ "$A" = "$B" ]) but the value of $C after running that is an empty string. I ...
user avatar
2 votes
2 answers
281 views

Batch script that should set a path variable breaks the string

Im trying to set a user-path variable via setx in a win-batch-script, but it keeps breaking. The path that I enter... setx path "%path%;%ProgramFiles%\Pseudocode\" ...leads to this: Sadly, ...
user avatar
  • 123
1 vote
1 answer
186 views

multiline environment variable in /etc/environment

Title says it all really. I'm trying to set an RSA private key in /etc/environment. Things I've tried include wrapping the variable in single and double quotes, add a backslash at the end of each line ...
user avatar
  • 111
0 votes
1 answer
172 views

UEFI Variable Storage (removing /sys/firmware/efi dump files) when Kernel Variables CONFIG_EFIVAR_FS & CONFIG_EFI_VARS both =y as in Ubuntu 20.04

In the Arch Wiki I see that the two kernel variables CONFIG_EFIVAR_FS & CONFIG_EFI_VARS should be set =y and =n respectively. Arch says, "This option should be disabled to prevent any ...
user avatar
  • 676
0 votes
0 answers
21 views

overcoming the WARNING: The length of the extracted value is truncated to 1024 characters

I have read this solution but they all fall into the case of the path which is not my case. Overcoming the 1024 character limit with setx Basically I created and want to use my environment variable, ...
user avatar
0 votes
0 answers
28 views

Adding a variable to the PATH variable not translating

I have a bunch of applications that I install using MDT packages. One of the packages needs an entry to the PATH variable. I would like to add a variable to the PATH variable. But this variable is not ...
user avatar
2 votes
1 answer
86 views

Bash or zsh conditional patterns and variable expansions

Suppose I want to generate a filename based on some given variables. track=01 title="Some title" album="Some album" echo ${track}. ${title} (${album}) -> 01. Some title (Some ...
user avatar
  • 141
1 vote
0 answers
100 views

Zsh: Passing multiple arguments to command (ls) from a variable ($LS_OPTIONS)

I am trying to customize ls command adding arguments to $LS_OPTIONS The ls alias and LS_OPTIONS are defined in the default config file: export LS_OPTIONS='--color=auto' ... alias ls='ls $LS_OPTIONS' ...
user avatar
  • 141
1 vote
1 answer
38 views

How to echo environment variable in variable in DOS

I am not sure if this question holds true but I am trying to get solution for my problem as below: set var1=ABC set otherevars=C:\temp2 set %var1%dfts=C:\temp\test all works fine till above line but, ...
user avatar
0 votes
0 answers
74 views

I cannot change the environment variable of %APPDATA%

Long ago I changed the %APPDATA% default path from C:Users\Username\Appdata to D:Users\Username\Appdata (I don't remember how). Now my D: hardrive crash and is no longer operational. I tried going to ...
user avatar
0 votes
1 answer
79 views

Windows 10 will not let me do anything to the system Path environment variable. Can't add, edit, or delete

When I try to do anything to the Path environment variable for system such as edit, add, or remove and entries I get "This environment variable is too large. This dialog allows setting values up ...
user avatar
  • 101
0 votes
0 answers
39 views

Malformed windows path environment variable

I haven't been able to find any information about this but my path environment variable has multiple entries that seem to be malformed. Any idea what would have caused this? F:\dev\emsdk; F:\dev\emsdk\...
user avatar
  • 1
1 vote
1 answer
14 views

PATH is not being refershed in VS Studio Power shell environment?

I have added MingGW to my path a couple of days ago and I have turned off my computer yet I find that the path has not been refreshed. I currently have a Windows 11 OS. I have to run this command ...
user avatar
0 votes
0 answers
47 views

Is having my AD password in the HTTP_PROXY environment variable a security risk?

Some applications don't respect my browser's proxy settings and instead rely on my environment settings - for those apps (Python and VS Code, in my case), I had to set up two Windows environment ...
user avatar
  • 1,073
1 vote
1 answer
108 views

Can the Windows %PROGRAMFILES(X86)% environment variable be accessed in Git Bash?

In Git Bash and Cygwin, I can easily access the Windows %PROGRAMFILES% environment variable: $ echo $PROGRAMFILES C:\Program Files $ echo ${PROGRAMFILES} C:\Program Files However, due to the ...
user avatar
  • 159
0 votes
0 answers
29 views

Reference a list in word VBA

I have a large mail merge document where I'm trying to find and replace certain text variables with the mail merge fields. I have the code below, but am wanting to reference a list of objects to fill ...
user avatar
  • 1
0 votes
1 answer
103 views

Set Client IP Address of an RDP Session as an environmental variable

My company uses some software that runs on our terminal server and connects back to a peripheral I have locally connected to my client laptop. The software defines an HKEY_CURRENT_USER registry key ...
user avatar
0 votes
0 answers
83 views

Ruby showing in $PATH for WSL2, but not available to run

I'm running WSL2. If I echo $PATH in the WSL2 terminal, I see /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/games:/usr/lib/wsl/lib: /mnt/c/Program Files/...
user avatar
3 votes
2 answers
485 views

TERM system environment variable not set - Windows 10

So by mistake I deleted a bunch of my environment variables... The one I cannot make sense of is TERM, a system-variable. Is this supposed to refer to the windows terminal? What value should I set it ...
user avatar
  • 33
1 vote
0 answers
15 views

What does the start command actually do? [duplicate]

Suppose I want to launch a program from the cmd (or windows powershell). If i simply type the name of the executable of course nothing starts, as my shell does not know where to find the .exe that I ...
user avatar
  • 132
0 votes
1 answer
977 views

Set a Windows environment variable from within Git Bash

Is it possible to set an actual Windows environment variable from within the Git Bash for example? I know that you can set environment variables via the Git Bash in general with e.g. FOOBAR=foo; ...
user avatar
  • 411
0 votes
0 answers
153 views

SQL Server: error message "Value cannot be null. Parameter name: urn" while creating backup job script

I'm trying to create a script for a backup job in SQL Server Management Studio (SSMS). However, I face the error message Value cannot be null. Parameter name: urn. The workflow up to that point is: ...
user avatar
  • 177
1 vote
1 answer
28 views

Added some console programs to System PATH, Can't invoke them via the registry

I added C:\Tools\scripts\PATH to my System PATH. It contains a few different console applications that I use frequently. When I run them from the command-line everything is fine. As an example: ...
user avatar
  • 49
0 votes
0 answers
164 views

How can I get the current user's environment variables from command line? not variables in the system

How can I get the current user's environment variables from the command line without including the environment variables in the system? I use %path% to get all of them, including the system ...
user avatar
1 vote
3 answers
52 views

Can i convert my code in a global enviroment variable?

I made this code to be able to easily move a directory between my SSD and HD and also output a timestamp in my robocopy log files easily, it worked so well that i want to turn my timestamp &z& ...
user avatar
  • 11
0 votes
0 answers
268 views

Can't activate my virtual environment after installing Miniforge

I'm running on an arm64 Mac on zsh, and installed anaconda3 and then later Miniforge (I think I did it to get my anaconda to run on the experimental M1 version of Conda). In my terminal the anaconda ...
user avatar
0 votes
0 answers
84 views

Typing echo %path% in cmd shows a path that I don't see on the edit environment variables menu

I have this path to Miniconda C:\Users\[username]\miniconda3\condabin that shows up as the first entry when I type echo %path% in my cmd.exe but upon trying to edit it through the system environment ...
user avatar
  • 1
0 votes
0 answers
33 views

Variables inside commands inside if statement

I do not understand why this does not work: existing_user=$(ldapsearch -x -b "cn=group,ou=group2,dc=company,dc=com" -H ldap://127.0.0.1 -D "cn=admin,dc=company,dc=com" -w "...
user avatar
0 votes
1 answer
31 views

Windows : launch .sh using environment variable

i'm trying on windows to launch my server from anywhere in my computer (start_server.sh). Launching my file containing those line manually works fine (using GitCMD) (probably not the best, i'm of ...
user avatar
  • 3
-1 votes
3 answers
1k views

How to get existing environment variable, change the value of it and display it after change with CMD command?

So, after discussing with Berend, I figured out that I need to explain myself better and that is what I'm going to do. So, my mission is to write a windows batch script that will: Display(print to ...
user avatar
0 votes
2 answers
166 views

How to call programs from cmd directly without adding their paths to PATH variable on windows?

Suppose I installed a new package with someProgram in it: myNewPackageDir/bin/someProgram If I want to accessing it from cmd using only its name (example: someProgram --option1 a --option2 b --option3 ...
user avatar
0 votes
1 answer
259 views

get a process's private environment variables in Windows using powershell

I have a process (testxx) running on my Database. Every time a user connects with the database the process will start separate session for. All processes include a private environment variable(Client-...
user avatar
  • 5
2 votes
2 answers
97 views

Finding an exe from any hard drive and setting it as a variable

I have a way to find an exe file from any drive without needing to play with %path%, but I need it set as a path-to-file variable, not just displayed. for %i in (a b c d e f g h i j k l m n o p q r s ...
user avatar
  • 229
0 votes
0 answers
25 views

Use windows environment variables in docker-compose.yaml file

I would like my Windows Username available in my (Linux) container as $WINDOWS_USERNAME using docker-compose. But when I try accessing it with ${env:USERNAME}, I get this error: ERROR: Invalid ...
user avatar
-1 votes
1 answer
108 views

Windows path variable contains wrong entry

I know that the resulting path is the concatenation of system + user variables. However, my resulting path contains an entry which I don't know where is coming from, and on top of that is malformed, ...
user avatar
  • 99
0 votes
0 answers
19 views

merging multiple system variables in Windows 10

Windows 10 system variables are typically path references. Is it possible to add multiple path references to a single variable? I have a lot of variables related to JAVA or ANDROIDSTUDIO and other ...
user avatar
  • 131
0 votes
0 answers
26 views

PATH not showing at all in System/Enviroment Variables

I was attempting to add Cygwin to my System PATH, but upon opening Environment Variables I noticed that there is no PATH variable to add to currently. Never had/heard of this happening.
user avatar
0 votes
1 answer
56 views

$PATH editting does not work

I am using Ubuntu 64-bit on a VM and installed an app, added it to $PATH using export PATH=$PWD/bin:$PATH in my terminal (T1). Worked fine. Then i wanted to use the command in another terminal (T2) ...
user avatar
0 votes
1 answer
111 views

Cannot access certain environment variables set in ssh_config

I've put together a batch script that provisions a development server: @echo off set mode=development set ssh_port=22 set secure_ssh_port=4096 if "%mode%" == "development" ( ...
user avatar
1 vote
1 answer
46 views

Docker get a list of possible environment variables

Hello! After intensive research I decided to bring this question up to the community. I started learning docker & docker-compose not long ago. My question is: How can I get a list of the possible ...
user avatar

1
2 3 4 5
25