microsoft / microsoft/WSL

Set Windows environment variables directly in wsl shell without modifying bash environment

Open
#6,747 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 14h
Merged PRs (30d)
107

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by tracing the existing WSLENV mechanism described in the report and determine where Windows environment variables are transferred. Done should allow setting a Windows variable from WSL without changing the same variable in the Bash environment, with coverage for the TEMP example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.