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
This commit is contained in:
Yuhang Guo 2025-05-14 06:01:21 +08:00 committed by GitHub
parent d3f37e41d0
commit 9f6c33f4a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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