From 95502b900d4165d982dcba1c09921d2e3f38e8dc Mon Sep 17 00:00:00 2001 From: josc146 Date: Wed, 31 Jan 2024 21:35:36 +0800 Subject: [PATCH] fix WSL2 WindowsOptionalFeature: Microsoft-Windows-Subsystem-Linux -> VirtualMachinePlatform --- backend-golang/wsl_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend-golang/wsl_windows.go b/backend-golang/wsl_windows.go index d881320..1cacb04 100644 --- a/backend-golang/wsl_windows.go +++ b/backend-golang/wsl_windows.go @@ -146,7 +146,7 @@ func (a *App) WslIsEnabled() error { } } - cmd := `-Command (Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux).State | Out-File -Encoding utf8 -FilePath ` + exDir + "/wsl.state" + cmd := `-Command (Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform).State | Out-File -Encoding utf8 -FilePath ` + a.exDir + "wsl.state" _, err = su.ShellExecute(su.RUNAS, "powershell", cmd, exDir) if err != nil { return err @@ -164,7 +164,7 @@ func (a *App) WslIsEnabled() error { } func (a *App) WslEnable(forceMode bool) error { - cmd := `/online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux` + cmd := `/online /enable-feature /featurename:VirtualMachinePlatform` _, err := su.ShellExecute(su.RUNAS, "dism", cmd, `C:\`) if err != nil { return err