我有一個由雲端運算服務配置的預先配置 Windows 10 VM。
此服務提供的所有 Win10 映像均將英文(美國)設定為預設系統語言。我對此無法控制。
我想要做的是編寫一個腳本,將系統區域設定(包括顯示語言、時區、文化資訊等)更改為不同的區域設置,例如德語(德國)。
要求是
- 切換必須完全自動化,因此不需要手動使用者互動(即無需手動下載任何內容,或在系統設定對話方塊中變更任何內容)。
- 變更必須是永久性的(即在虛擬機器重新啟動後仍然有效)。
我怎麼做?
答案1
我發現一篇關於它的文章。
編輯:似乎有一個解釋頁面:https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_CURRENT_USER/Control-Panel/International/index
原作者採用以下解決方案,更改了您的 de-DE 的第一部分:
$DefaultHKEY = "HKU\DEFAULT_USER"
$DefaultRegPath = "C:\Users\Default\NTUSER.DAT"
Set-Culture de-DE
Set-WinSystemLocale de-DE
Set-WinHomeLocation -GeoId 94 # Germany (see https://docs.microsoft.com/de-ch/windows/win32/intl/table-of-geographical-locations)
Set-WinUserLanguageList de-DE
reg load $DefaultHKEY $DefaultRegPath
reg import ".\de-DE-default.reg"
reg unload $DefaultHKEY
reg import ".\de-DE-welcome.reg"
和註冊表文件:
Windows Registry Editor Version 5.00
[HKEY_USERS\DEFAULT_USER\Control Panel\International]
"Locale"="00000407" ; source: https://renenyffenegger.ch/notes/Windows/development/Internationalization/language#windows-language-id
"LocaleName"="de-DE"
;"s1159"="AM"
;"s2359"="PM"
"sCountry"="Germany"
"sCurrency"="€"
"sDate"="/"
"sDecimal"="."
"sGrouping"="3;0"
"sLanguage"="ENG"
"sList"=","
"sLongDate"="dd MMMM yyyy"
"sMonDecimalSep"="."
"sMonGrouping"="3;0"
"sMonThousandSep"=","
"sNativeDigits"="0123456789"
"sNegativeSign"="-"
"sPositiveSign"="+"
"sShortDate"="dd/MM/yyyy"
"sThousand"=","
"sTime"=":"
"sTimeFormat"="HH:mm:ss"
"sShortTime"="HH:mm"
"sYearMonth"="MMMM yyyy"
"iCalendarType"="1"
"iCountry"="44"
"iCurrDigits"="2"
"iCurrency"="0"
"iDate"="1"
"iDigits"="2"
"NumShape"="1"
"iFirstDayOfWeek"="0"
"iFirstWeekOfYear"="2"
"iLZero"="1"
"iMeasure"="0"
"iNegCurr"="1"
"iNegNumber"="1"
"iPaperSize"="9"
"iTime"="1"
"iTimePrefix"="0"
"iTLZero"="1"
[HKEY_USERS\DEFAULT_USER\Control Panel\International\Geo]
"Nation"="242"
[HKEY_USERS\DEFAULT_USER\Control Panel\International\User Profile]
"Languages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00
"ShowAutoCorrection"=dword:00000001
"ShowTextPrediction"=dword:00000001
"ShowCasing"=dword:00000001
"ShowShiftLock"=dword:00000001
[HKEY_USERS\DEFAULT_USER\Control Panel\International\User Profile\en-GB]
"CachedLanguageName"="@Winlangdb.dll,-1110"
"0809:00000809"=dword:00000001
[HKEY_USERS\DEFAULT_USER\Control Panel\International\User Profile System Backup]
"Languages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00
"ShowAutoCorrection"=dword:00000001
"ShowTextPrediction"=dword:00000001
"ShowCasing"=dword:00000001
"ShowShiftLock"=dword:00000001
[HKEY_USERS\DEFAULT_USER\Control Panel\International\User Profile System Backup\en-GB]
"CachedLanguageName"="@Winlangdb.dll,-1110"
"0809:00000809"=dword:00000001
[HKEY_USERS\DEFAULT_USER\Keyboard Layout]
[HKEY_USERS\DEFAULT_USER\Keyboard Layout\Preload]
"1"="00000809"
[HKEY_USERS\DEFAULT_USER\Keyboard Layout\Substitutes]
[HKEY_USERS\DEFAULT_USER\Keyboard Layout\Toggle]
[HKEY_USERS\DEFAULT_USER\Control Panel\Desktop\MuiCached]
"MachinePreferredUILanguages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00,00,00
[HKEY_USERS\DEFAULT_USER\Control Panel\Desktop]
"PreferredUILanguages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00
Windows Registry Editor Version 5.00
[HKEY_USERS\.DEFAULT\Control Panel\International]
"Locale"="00000809"
"LocaleName"="en-GB"
"s1159"="AM"
"s2359"="PM"
"sCountry"="United Kingdom"
"sCurrency"="£"
"sDate"="/"
"sDecimal"="."
"sGrouping"="3;0"
"sLanguage"="ENG"
"sList"=","
"sLongDate"="dd MMMM yyyy"
"sMonDecimalSep"="."
"sMonGrouping"="3;0"
"sMonThousandSep"=","
"sNativeDigits"="0123456789"
"sNegativeSign"="-"
"sPositiveSign"="+"
"sShortDate"="dd/MM/yyyy"
"sThousand"=","
"sTime"=":"
"sTimeFormat"="HH:mm:ss"
"sShortTime"="HH:mm"
"sYearMonth"="MMMM yyyy"
"iCalendarType"="1"
"iCountry"="44"
"iCurrDigits"="2"
"iCurrency"="0"
"iDate"="1"
"iDigits"="2"
"NumShape"="1"
"iFirstDayOfWeek"="0"
"iFirstWeekOfYear"="2"
"iLZero"="1"
"iMeasure"="0"
"iNegCurr"="1"
"iNegNumber"="1"
"iPaperSize"="9"
"iTime"="1"
"iTimePrefix"="0"
"iTLZero"="1"
[HKEY_USERS\.DEFAULT\Control Panel\International\Geo]
"Nation"="242"
[HKEY_USERS\.DEFAULT\Control Panel\International\User Profile]
"Languages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00
"ShowAutoCorrection"=dword:00000001
"ShowTextPrediction"=dword:00000001
"ShowCasing"=dword:00000001
"ShowShiftLock"=dword:00000001
[HKEY_USERS\.DEFAULT\Control Panel\International\User Profile\en-GB]
"CachedLanguageName"="@Winlangdb.dll,-1110"
"0809:00000809"=dword:00000001
[HKEY_USERS\.DEFAULT\Control Panel\International\User Profile System Backup]
"Languages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00
"ShowAutoCorrection"=dword:00000001
"ShowTextPrediction"=dword:00000001
"ShowCasing"=dword:00000001
"ShowShiftLock"=dword:00000001
[HKEY_USERS\.DEFAULT\Control Panel\International\User Profile System Backup\en-GB]
"CachedLanguageName"="@Winlangdb.dll,-1110"
"0809:00000809"=dword:00000001
[HKEY_USERS\.DEFAULT\Keyboard Layout]
[HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
"1"="00000809"
[HKEY_USERS\.DEFAULT\Keyboard Layout\Substitutes]
[HKEY_USERS\.DEFAULT\Keyboard Layout\Toggle]
[HKEY_USERS\.DEFAULT\Control Panel\Desktop\MuiCached]
"MachinePreferredUILanguages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00,00,00
[HKEY_USERS\.DEFAULT\Control Panel\Desktop]
"PreferredUILanguages"=hex(7):65,00,6e,00,2d,00,47,00,42,00,00,00