-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Windows environment variables directly in wsl shell without modifying bash environment #6747
Comments
but that's in a child shell. as soon as powershell closes, the environment variable is gone. |
The Windows environment set by |
wsl lets us launch windows executables directly. It's nice if we can launch the windows executable directly, with various environment variables, instead of via a command shell or powershell child shell. WSLENV is useful because it let's us share bash environment variables with windows. But it would be more powerful if there was a mechanism to set windows environment variables without modifying the bash environment. |
export TEMP=42
export WSLENV=TEMP/w
TEMP=63 cmd.exe /c echo %TEMP%
TEMP=99 cmd.exe /c echo %TEMP%
echo $TEMP export TEMP=42
export WSLENV=TEMP/w
(
TEMP=63
cmd.exe /c echo %TEMP%
TEMP=99
cmd.exe /c echo %TEMP%
)
echo $TEMP |
Is your feature request related to a problem? Please describe.
Suppose the user wants to set windows environment variables from wsl.
In the current mechanism, the user needs to first set a bash environment variable, then export it as a windows environment variable via WSLENV. The problem is that this defines environment variables in the bash shell as well.
Suppose that the windows environment variable has the same name as a bash environment variable.
Currently it's impossible to set one value for bash shell, and a different value for windows environment.
For example:
suppose we want to set "TEMP" windows environment variable from wsl.
The user has to do:
export TEMP=...
export WSLENV=TEMP/w:...
The problem is that this will modify the value of TEMP environment variable in bash shell as well.
Describe the solution you'd like
We need some mechanism to set windows environment variables from wsl without modifying the bash environment.
Something like:
win_env_set TEMP = ...
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: