Fix language issues in install WSL ps1 script (#12284)
* Update install-latest-wsl.ps1 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 "系统类型". * Updated regular syntax
Yuhang Guo committed
May 14, 2025 at 06:01 UTC
9f6c33f4a7f60da7a3228c0ae7c2c7ed74503f51
1 file changed
+9
triage/install-latest-wsl.ps1
+9
@@ -2,6 +2,12 @@
2
3
# This script downloads and installs the latest version of the WSL MSI package
4
5
+# Get current language code
6
+$chcp_num = (chcp) -replace '[^\d]+(\d+).*','$1'
7
+
8
+# Set language to english
9
+chcp 437
10
+
11
$ErrorActionPreference = "Stop"
12
Set-StrictMode -Version Latest
13
@@ -48,3 +54,6 @@ if ($exitCode -Ne 0)
54
Write-Host 'Installation complete'
55
56
Remove-Item $target -Force
57
+
58
+# Restore original language
59
+chcp $chcp_num