From 5fa7886a82797ebb9fbb2811196fcdb5f3c95a73 Mon Sep 17 00:00:00 2001 From: Yuhang Guo <22561797+Sherry520@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:58:15 +0800 Subject: [PATCH] Update install-latest-wsl.ps1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/microsoft/WSL/issues/12282#issuecomment-2480894130 The install-latest-wsl.ps1 script cannot parse the operating "System Type" '$systeminfo = & systeminfo | findstr /C:"System Type"' due to language problems. In the Chinese interface environment, "System Type" is the Chinese "系统类型". --- triage/install-latest-wsl.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/triage/install-latest-wsl.ps1 b/triage/install-latest-wsl.ps1 index 975f64ff..3477e792 100644 --- a/triage/install-latest-wsl.ps1 +++ b/triage/install-latest-wsl.ps1 @@ -2,6 +2,12 @@ # This script downloads and installs the latest version of the WSL MSI package +# Get current language code +$chcp_num = (chcp) -replace '\D+\(\d+)','$1' + +# Set language to english +chcp 437 + $ErrorActionPreference = "Stop" Set-StrictMode -Version Latest @@ -48,3 +54,6 @@ if ($exitCode -Ne 0) Write-Host 'Installation complete' Remove-Item $target -Force + +# Restore original language +chcp $chcp_num