如何在 非C盘 安装 WSL?

来源:https://superuser.com/questions/1572834/is-there-any-way-to-install-wsl-on-non-c-drive


首先打开 Powershell,输入如下命令 (Set-Location 到你想放置 WSL2 的磁盘)

# Substitute the drive on which you 
# want WSL to be installed if not D:
Set-Location E:

# Create a directory for our installation and change to it, we'll call it WSL:
New-Item WSL -Type Directory
Set-Location .\WSL

# Make downloads faster by not displaying progress bar:
$ProgressPreference = 'SilentlyContinue'
# Using the URL you found above, download the appx package:
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Linux.appx -UseBasicParsing

# Make a backup and unpack:
Copy-Item .\Linux.appx .\Linux.zip
Expand-Archive .\Linux.zip

# Search for the installer:
Get-Childitem -Filter *.exe

随后输入如下命令

Set-Location Linux
# look for correct appx file:
Get-Childitem -Filter *.appx
# rename to .zip so that Expand-Archive will work
ren .\Ubuntu_2204.1.7.0_x64.appx .\Ubuntu_2204.zip
Expand-Archive .\Ubuntu_2204.zip
Set-Location .\Ubuntu_2204
# Now exe should exist:
Get-Childitem -Filter *.exe
# run it
.\ubuntu.exe

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值