Windows命令行开启WSL2

护发师兄 / 2023-07-31 / 原文

Windows命令行开启WSL2

打开带管理员权限的终端(powershell)

依次输入以下四条命令并重启

wsl --install
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2