Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, Windows environment variables can be obtained and used within WSL environment. They can be accessed through the /mnt directory, where the Windows files system is mounted. For example, the value of the USERNAME environment variable can be obtained by running the command echo $USERNAME in the WSL terminal.

To access other Windows environment variables, prefix them with $env: in PowerShell and use them as usual. For example:

$env:APPDATA 

This will show the path to the current user's application data folder in Windows.