0

I have used the commands

export http_proxy=address:port

and

export https_proxy=address:port

to set http and https proxy in bash in WSL. But every time I open bash, the environment variables are becoming empty. I tried setting up these variables in /etc/environment and ~/.bashrc too.

I am using bash.exe command in cmd promt to open bash.

1
0

I think WSLENV will work well for you. Here is perfectly documented: https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/

enter image description here

-1

If you use export, you can only use the environment variables on that terminal session. Else, you have to add it to /etc/enviroment.

But if you aren't logged in as root, you can't use it. You should change the permissions of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.