เป็น PowerShell script ที่ช่วยเอาภาษาไทย ออกจากระบบ windows และทำตัวเปลี่ยนภาษากลับไปเหมือนเดิม ถามว่าทำเพื่อ ก็อย่างเช่น ใส่ไว้ในป้ายโฆษณา แล้วไม่อยากให้ iso มันใหญ่
language_pack_remove_thai.ps1
# =========================================================
# Script: Remove Thai Language Pack + Reset Hotkey (All Users) # Version: 2.0.0 (Removal Edition) # ========================================================= # 0. Check Administrator rights
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent ()) .IsInRole ([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "Please run this script as Administrator" -ForegroundColor Red pause exit
} Write-Host "Removing Thai Language Pack..." -ForegroundColor Cyan
$thaiPacks = Get-WindowsCapability -Online | Where-Object { $_.Name -like "Language.Basic~~~th-TH*" }
if ($thaiPacks) { foreach ($pack in $thaiPacks) { if ($pack.State -eq "Installed") { try { Write-Host "Removing $ ($pack.Name) ..." -ForegroundColor Yellow Remove-WindowsCapability -Online -Name $pack.Name -ErrorAction Stop Write-Host "Removed $ ($pack.Name) " -ForegroundColor Green } catch { Write-Host "Failed to remove $ ($pack.Name) : $ ($_.Exception.Message) " -ForegroundColor Red } } }
} else { Write-Host "No Thai Language Pack found." -ForegroundColor Green
} Write-Host "Setting language order to EN-US only..." -ForegroundColor Cyan
try { $LangList = New-WinUserLanguageList en-US Set-WinUserLanguageList -LanguageList $LangList -Force -ErrorAction Stop Set-WinDefaultInputMethodOverride -InputTip "0409:00000409" Start-Sleep -Seconds 2
} catch { Write-Host "Failed to set language: $ ($_.Exception.Message) " -ForegroundColor Red pause exit
} Write-Host "Resetting language toggle Hotkey to default (Alt+Shift) ..." -ForegroundColor Cyan
$TogglePath = "HKCU:\Keyboard Layout\Toggle"
if (! (Test-Path $TogglePath)) { New-Item -Path $TogglePath -Force | Out-Null }
Set-ItemProperty -Path $TogglePath -Name "Hotkey" -Value "1" -Type String -Force
$LegacyPath = "HKCU:\Control Panel\Input Method\Hot Keys\00000000"
if (Test-Path $LegacyPath) { Remove-ItemProperty -Path $LegacyPath -Name "Key Modifiers" -ErrorAction SilentlyContinue Remove-ItemProperty -Path $LegacyPath -Name "Virtual Key" -ErrorAction SilentlyContinue
}
Write-Host "Settings applied for current user" -ForegroundColor Green Write-Host "Copying settings to Welcome Screen..." -ForegroundColor Cyan
try { Copy-UserInternationalSettingsToSystem -WelcomeScreen -NewUser -ErrorAction Stop Write-Host "Copy successful" -ForegroundColor Green
} catch { Write-Host "Cannot copy to Welcome Screen (normal on some Win 11 builds) " -ForegroundColor Yellow
} Write-Host "Resetting Hotkey for Default User..." -ForegroundColor Cyan
$DefaultUserPath = "C:\Users\Default\NTUSER.DAT"
$MountPath = "HKLM\DefaultUserTemp"
if (Test-Path $DefaultUserPath) { try { reg load $MountPath $DefaultUserPath 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { throw "Failed to load hive" } $DefTogglePath = "Registry::HKEY_LOCAL_MACHINE\DefaultUserTemp\Keyboard Layout\Toggle" if (! (Test-Path $DefTogglePath)) { New-Item -Path $DefTogglePath -Force | Out-Null } Set-ItemProperty -Path $DefTogglePath -Name "Hotkey" -Value "1" -Type String -Force $DefLegacyPath = "Registry::HKEY_LOCAL_MACHINE\DefaultUserTemp\Control Panel\Input Method\Hot Keys\00000000" if (Test-Path $DefLegacyPath) { Remove-ItemProperty -Path $DefLegacyPath -Name "Key Modifiers" -ErrorAction SilentlyContinue Remove-ItemProperty -Path $DefLegacyPath -Name "Virtual Key" -ErrorAction SilentlyContinue } Write-Host "Default User settings applied" -ForegroundColor Green } catch { Write-Host "Error setting Default User: $ ($_.Exception.Message) " -ForegroundColor Red } finally { Set-Location C:\ [gc]::Collect () [gc]::WaitForPendingFinalizers () Start-Sleep -Milliseconds 500 $unloadRetry = 0 while ($unloadRetry -lt 5) { reg unload $MountPath 2>$null | Out-Null if ($LASTEXITCODE -eq 0) { Write-Host "Unloaded Default User Registry." -ForegroundColor Gray break } $unloadRetry++ Start-Sleep -Seconds 1 } if ($unloadRetry -eq 5) { Write-Host "Cannot unload Registry, may need restart" -ForegroundColor Red } }
} else { Write-Host "Default User NTUSER.DAT not found" -ForegroundColor Red
} Write-Host "====================================================" -ForegroundColor Cyan
Write-Host "All operations completed!" -ForegroundColor Green
Write-Host "Recommend Sign out or Restart" -ForegroundColor Yellow
Write-Host "====================================================" -ForegroundColor Cyan pause
วิธีใช้
- สร้างไฟล์ language_pack_remove_thai.ps1 โดยใช้ notepad แล้ว save as เป็น language_pack_remove_thai.ps1 บน Desktop หรือจะใส่ใน USB เลยก็ได้
- ใส่เนื้อหาตามข้างบน
- ไปที่เมนูของ windows
- ช่องค้นหา พิมพ์ powershell
- พิมพ์ cd ตามด้วย folder ที่ save language_pack_remove_thai.ps1 ไว้อย่าง
cd /d %USERPROFILE%/Desktop - ใช้โดยพิมพ์ ./language_pack_remove_thai.ps1
- ทำตามขั้นตอนไปเรื่อย ๆ
อ่านเพิ่มเติม