I'm new to WSL as a development environment, and I'm trying to set some environment variable to begin working on an open source project. In this case, a domain and secret key. I've followed the steps mentioned here https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/ and here https://medium.com/@kevinv92/how-to-use-wslenv-to-share-environment-variables-between-windows-and-wsl-c06099d5b901 and this is output:
Microsoft Windows [Version 10.0.19041.388]
(c) 2020 Microsoft Corporation. All rights reserved.
C:\Users\kyles>wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
C:\Users\kyles>echo %WSLENV%
MVC_FIREBASE_API_KEY/p:MVC_FIREBASE_DOMAIN/p
C:\Users\kyles>echo %MVC_FIREBASE_DOMAIN%
minimum-viable-ceremonies-dev
C:\Users\kyles>wsl
kylesnowschwartz@DESKTOP-VN55S9F:/mnt/c/Users/kyles$ echo $WSLENV
MVC_FIREBASE_API_KEY/p:MVC_FIREBASE_DOMAIN/p
kylesnowschwartz@DESKTOP-VN55S9F:/mnt/c/Users/kyles$ echo $MVC_FIREBASE_DOMAIN
Nothing is output when for the environment variable, as I am expecting. I would appreciate any help in understanding what I don't understand!
The Microsoft blog entry is a bit confusing. Fortunately your problem is quite simple: You are using path translation option /p but your environment variable is not a path!
Passing environment variable from Windows to WSL, use /u option:
Microsoft Windows [Version 10.0.19044.1706]
(c) Microsoft Corporation. All rights reserved.
C:\Users\arttu>set MVC_FIREBASE_DOMAIN=minimum-viable-ceremonies-dev
C:\Users\arttu>set WSLENV=%WSLENV%:MVC_FIREBASE_DOMAIN/u
C:\Users\arttu>wsl
$ echo $MVC_FIREBASE_DOMAIN
minimum-viable-ceremonies-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With