Yes, in powershell, do (for example)
..user > subst W: '\\wsl$\Ubuntu-20.04\home\username\'
And you're in business. But, yes, I know what you're thinking - you don't want to do this manually.
You want to fire up WSL TTY (mintty) and have this DONE for you!
In your Ubuntu filesystem, maintain a file ending in a .ps1 extension and containing :
subst W: '\\wsl$\Ubuntu-20.04\home\analog\'
Then, in your .profile, just have :
powershell.exe -File /path/to/subst_cmd.ps1
(FYI, Thanks Thanh Phu, do delete this mapping, you'd do subst W: /D )
And you're through. Now, here's something trickier :
Without ever leaving WSL, how would you get Windows Firewall to allow communication between WSL
and the X-server you set up (follow Thomas Ward's excellent page to set up vcxsrv)
The answer :
Put this command in a file somewhere on windows (not Ubuntu) :
Set-NetFirewallProfile -DisabledInterfaceAliases "vEthernet (WSL)"
Then, all you do is :
powershell.exe -Command "Start-Process powershell.exe -ArgumentList \"-File C:\path\to\ps_fw_setting_WSL.ps1\" -Verb RunAs"
Which is something you could stick in your .profile
Niciun comentariu:
Trimiteți un comentariu