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).
1,320 questions
0 votes
2 answers
105 views
Why does WinGet have `curl` available if its never going to be used, since system32 curl takes precedence?
As the title says. WinGet has a package called cURL.cURL. However, installing it doesn't do what you would expect it to do. Any invocation of curl via command line or otherwise will use the curl.exe ...
2 votes
1 answer
75 views
How to wrap PS one-liner to run elevated
I need to run the following as admin from a non-elevated session. This works if initiated from an elevated one. [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\MyPath&...
8 votes
2 answers
2k views
Why does a new Windows 11 PC have repeated paths in %PATH%?
I started up a new PC, a Beelink Mini S-13 delivered by Amazon from a marketplace seller. It arrived in untouched cellophane shrink-wrapped packaging. This has Windows 11 preinstalled. I went through ...
2 votes
1 answer
496 views
When running VS Code remote ssh, zsh doesn't have VS Code in $PATH
I'm running VS Code with Remote SSH. When I open a zsh terminal, the entry in $PATH is missing for VS Code server, and so I can't run code --wait filename (which I like to have set as my $EDITOR ...
8 votes
2 answers
291 views
Is there a good way to use environment modules to set up conda as an alternative to "conda init"?
Is there a good way to use environment modules to set up conda as an alternative to conda init? In our HPC environment we have many versions of many different tools, and often when users switch ...
0 votes
2 answers
166 views
How to use exported shell variable inside Docker Compose container?
I am using docker compose to pull the image and run the container. During this process I am calling a shell script to encrypt DB password and using export command I export to a variable. e.g. export ...
0 votes
2 answers
285 views
Environment variables and systemd
I'm installing SonarQube Community Build on Ubuntu. I've installed Java from a .tar.gz to /opt/java. I've added JAVA_HOME=/opt/java/ and SONAR_JAVA_PATH=/opt/java/bin/java to my .profile file. echo $...
1 vote
1 answer
279 views
How to bind-mount AWS credentials into Dev Container, using path with environment variable?
I'd like to bind-mount my AWS credentials file into a DevContainer for development in VS Code, in a portable manner so other colleagues can develop on their machines too, so I need a relative ...
1 vote
1 answer
249 views
Expand variables in arguments in PowerShell
I'm trying to write a PowerShell script that copies a temporary directory on the local PC, copies files and folders from the server to the temporary directory and finally executes a setup installer ...
1 vote
4 answers
1k views
Windows-11: from a batch file , is it possible to set environment variables for a new process? I.e., to launch a process with specific variables set
I want to launch a new instance of a program or shell, such as Far (or cmd) with some specific environment variables set. I prefer to make a batch file for this. I try the following: in the ...
1 vote
2 answers
537 views
How to have different .bash_history per Visual Studio Code workspace?
I would like to have a different bash history per VSCode workspace. It seems setting: "terminal.integrated.env.linux": { "HISTFILE": "${workspaceFolder}/.bash_history" ......
0 votes
0 answers
195 views
How do I get my auto-populated environment variable into the crontab so it loads $HTTP_PROXY that is autogenerated by my WPAD and Windows 11?
I am having an issue with WSL it is not loading my proxy info into /etc/environment/ it loads everything else. Windows 11 populates the HTTP_PROXY variable by way of .wslconfig stored on the host ...
0 votes
0 answers
62 views
Hidden environmental variable definitions in Windows?
I am facing the problem that openssl tries to load an invalid openssl.cfg file (like described here https://stackoverflow.com/questions/7360602/openssl-and-error-in-reading-openssl-conf-file). The ...
0 votes
0 answers
68 views
Creation of large amounts of small files using Batch scripting with varying naming schems and contents defined by 2 text files
I'm trying to make a batch file to help generate a large amount of files that are similar but differ in name as well as called variables inside the files the file would contain a variable-name that is ...
1 vote
0 answers
82 views
How do you create a PS1 variable that starts on the first line but has a second line? [closed]
I have recently moved to Linux on my computer, and my bash terminal just looks dull. I customized the PS1 variable in the .bashrc, but that still didn't help. I want to be able to put a more ...
0 votes
0 answers
193 views
bash: "no such file or directory" for executable in PATH
In my process of installing java (as part of weblogic) with ansible I get this issue. I have seen that before from time to time, but cannot recall the solution. I have a new linux user "weblogic&...
1 vote
0 answers
23 views
Virtual paths broken? [duplicate]
So, I have been having a recurring problem with Windows, thought it was a Windows 10 issue, upgraded to 11, and suddenly realized it still existed, Shows unity calling a package with the "g" ...
5 votes
2 answers
18k views
How to set a folder to the path environment variable in Windows 11
There aren't many guides available on adding a folder to the Windows 11 user Path environment variable. This is useful for new programmers to be able to easily run code using command prompt. An answer ...
2 votes
1 answer
2k views
How to set a global variable from a bash function when its output is piped to another command
Let us define this very small bash function: function testit() { a=4 echo "Hello world" } if I run the function, then variable a will take the value 4 (which is the expected outcome): ...
0 votes
0 answers
2k views
Is the default value for Windows 11's PATH variable the same as it was for Windows 10?
I'm writing documentation, and I want to be able to tell those who read it whether or not they have to set their path variable to be able to run an executable without the full path attached to the ...
0 votes
4 answers
443 views
How to run a program with su privilege without using sudo?
I have this in my .bashrc file export ANDROID_HOME=$HOME/Android export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin I can run a program anywhere inside the directory set: adb devices // but no ...
0 votes
0 answers
557 views
Windows: Changes to PATH variable not detected, even after terminal restart
I've been having an issue with my Windows 11 computer that has become increasingly frustrating. Whenever I install a new CLI tool (most recently AWS CLI), it is never manually added to my PATH. Even ...
2 votes
2 answers
324 views
Can I find from which directory a command was executed?
A command find . -type f was issued on one of our servers by one of our users and its currently running when viewed in ps aux. How can I know from which directory was this command issued. Does that ...
0 votes
1 answer
65 views
Changed Windows PATH env variable and now many programs are no longer recognized
I messed up with Windows 10 PATH and now many programs are not recognized any longer, like for example git.exe At system level I have the following PATH: %SystemRoot%\system32 %SystemRoot% %...
1 vote
1 answer
63 views
Can system variables reference user variables?
What it says on the tin. I want a system variable %dl% = %USERPROFILE%\Downloads for Jon: %dl% = C:\Users\Jon\Downloads for Ann: %dl% = C:\Users\Ann\Downloads and so forth. Will that work, or do I ...
0 votes
0 answers
94 views
Windows 11. Number of duplicate entry's $Path variable
Why are the so many C:\WINDOWS\system32\WBEM entry's in the $PATH variable? I deleted them all except for 1 but after a while they are back again.... Only 1 is necessary. Not 8!! Path variable --------...
2 votes
0 answers
202 views
Is it possible to forward credentials to a Remote Desktop session?
I would like to achieve something similar to SSH agent forwarding with Windows 10 and Remote Desktop. Let's say I have some secret on my host, either in an environment variable or in Windows ...
1 vote
0 answers
166 views
MobaXterm configuration with Windows variables
I was trying to configure the MobaXterm configurations to different hosts and was trying to use windows variables inside the host configuration. Unfortunatly it doesn't seem to work properly and seems ...
0 votes
0 answers
390 views
Locale setting warnings when running Perl commands with Strawberry Perl
I am using Strawberry Perl to run Perl on Windows 10. The problem is: whenever I type a Perl command, it always shows warning messages like below: command: perl -v result: perl: warning: Setting ...
0 votes
1 answer
195 views
%localappdata% and echo %localappdata% returns two different directories [closed]
I'm having some issues with Windows 10. After fixing my temp INET folder which somehow was pointing at a different account, I've now found an odd issue. If I type echo %localappdata% in CMD, it gives ...
1 vote
0 answers
533 views
Does Windows 11 have a 32,767 character limit for environment variables?
(See also: Why does Windows have a limit on environment variables at all?) According to the Windows app development documentation, “The maximum size of a user-defined environment variable is 32,767 ...
-2 votes
1 answer
51 views
In there some description of all the command processor macros in Windows?
I'm looking for a list of the macro strings known to Window 10 command processor, e.g. %ProgramFiles%, %ProgramFiles(x86)%, etc.
0 votes
0 answers
264 views
Environment variables such as PATH not visible in processes started as service
I have randomly bumped into this as I can clearly see that PATH variable is not populated in the process that I'm now starting as a service on Windows 11, while the same exact script when started from ...
1 vote
2 answers
7k views
How to safely store environmental variables and make it actually invisible in my PC?
I am learning about environmental variables. I know for example that if I have a secret password I should not code it inside of my code. From what I understood is that a .env file should be used to ...
3 votes
1 answer
537 views
LANGUAGE environment variable ignores `en` (English)
On my Linux systems, I prefer the user interface to be in English. However, as a native speaker of German, I need spell checking to understand both English and German. Yesterday I've learned that you ...
0 votes
0 answers
382 views
Using Jdk1.8 and installing openjdk 11
I had a working java 8 application in my windows asset until I installed jdk11 using Ubuntu package. Now when I give java -version cmd in Ubuntu I get the openjdk 11 version: $ java -version openjdk ...
2 votes
2 answers
2k views
How to backup the environment variable configuration for windows 10?
The situation is as follows: Windows 10 22H2 (referred to as System A for short) cannot start (installed on hard drive A), nor can it enter safe mode or other startup modes, as starting will result in ...
0 votes
2 answers
381 views
How many environment variables does Windows 11 allow?
I have quite many environment variables scattered both in User Variables and System variables, and I cannot add more variables, which leads me to a question: is there an upper limit on the number of ...
0 votes
0 answers
23 views
Character limit Trying to modify the system PATH variable after already entered the long path in register give error msg [duplicate]
Getting this error in windows 10 64 bit I did enable to enter long size path from the registry My question is how to disable this character limitation ? I most say that this limitation is happening ...
1 vote
0 answers
619 views
How do I set env variables for Docker on Windows desktop?
I'm trying to set up Sabnzbd and this is what I'm attempting to set: I am getting this message: s6-linux-init: warning: unable to dump kernel environment to /run/s6/container_environment: Is a ...
4 votes
2 answers
1k views
How do I persist windows variables set in a CMD file?
in windows I would like to have a cmd script that I can run which sets an environment variable. The variable should still be set after the script executes. The variable is a token of sorts and is ...
0 votes
1 answer
708 views
How many environment variables can be passed through openssh SendEnv/AcceptEnv
I have added SendEnv whatever_* in ~/.ssh/config on the local host and AcceptEnv LANG LC_* whatever_* in /etc/ssh/sshd_config on the remote host. Now, I'm trying to run some stuff on the remote ...
2 votes
0 answers
1k views
VSCode unable to sign commits
If I try to commit something, I'm getting this error. > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - -S error: gpg failed to sign the data: gpg: skipped <redacted&...
0 votes
0 answers
116 views
Windows cmd won't recognize changed PATH
Few days ago I installed Tesseract OCR by installing Capture2Text via Chocolatey. This proved not to work, and instead of uninstalling Capture2Text I went ahead and deleted the Capture2Text folder ...
2 votes
0 answers
1k views
My PATH environment variable got lost during an installation this morning Windows 11
I noticed that commands weren't working in my command prompt. I tried rebooting but still the same problem. Eventually after looking in this forum, I found out that my PATH variable was effectively ...
0 votes
0 answers
133 views
Why does echo $(TZ=GMT+17 date +%Y%m%d%H%M%S) show me yesterday?
When I run this command today, November 8, 2023 at 1100 GMT, the output is: 20231107180000: echo $(TZ=GMT+17 date +%Y%m%d%H%M%S) I would have thought that, if anything, GMT+17 would ADD 17 hours to ...
0 votes
1 answer
8k views
Why is 'kubectl' is not recognized as an internal or external command on WIndows?
I edited env variables by pointing to kubectl and helm(after downloading them and storing into kube folder) when I go for kubectl in cmd,I got 'kubectl' is not recognized as an internal or external ...
0 votes
0 answers
135 views
Permissions on specific subfolders with Set-Acl
I have to create a set of folders based on an address list and then configure the permissions in active directory. Creating the folders and subfolders works for me, I adapted a few lines I found ...
2 votes
1 answer
1k views
Node wont run from cmd unless the .exe extension is added
So this is a very weird one. Let me start by saying that things used to work fine. I installed Node a few days ago and once complete I opened a command prompt (On Windows 10), I entered node --version ...
0 votes
1 answer
9k views
How to verify if a variable is equal to an other variable or a Windows variable in batch files?
I am making a "locked" batch file that only certain user can use so what I am doing right now is to check the condition if what the user write is == to %username% or other variable like this:...