PowrShell UICulture与Windows设置 [英] PowrShell UICulture vs. Windows setting
问题描述
在Win 10下修改PS 5.1期间,与问题键盘和语言" "地区和语言"标签中的控制面板"如此处所示.
可以在PS内部永久更改此设置吗? 到目前为止,我发现的所有内容都只保留一个会话.
设置设置-> 时间和语言-> 语言-> Windows显示语言显示Español(España)",而PS给出
> Get-UICulture ; [System.Threading.Thread]::CurrentThread.CurrentUICulture ; [CultureInfo]::CurrentUICulture ;
LCID Name DisplayName
---- ---- -----------
1033 en-US English (United States)
1033 en-US English (United States)
1033 en-US English (United States)
没有任何干预性更改,并且在刚刚启动的会话中.
在Windows上,所谓的 Windows 显示语言 是已知的用户特定设置作为.NET中的 UI文化并体现为:
-
在PowerShell中自动
Get-UICulture
cmdlet.
在 -
快速打开设置"应用程序:
- 使用键盘快捷键 WinKey-i .
- 运行
start ms-settings:
(也可以从cmd
运行).
-
在开始"菜单中,只需键入"Language"并从结果中选择
Language Settings
-直接将您带到设置"应用中的相关页面. -
运行
intl.cpl
以打开旧版Region
控制面板小程序,然后单击Language preferences
链接,该链接会将您带到设置"应用程序中的相关页面.- 顺便说一句,
intl.cpl
允许您切换到.NET中的另一 locale ,又名 culture (Get-Culture
/[cultureinfo]::CurrentCulture
(Set-WinUILanguageOverride
cmdlet.请注意,它至少需要Windows 8/Windows Server 2012,并且仅在重新启动后或注销并重新启动后生效. .
此外,目标语言必须已经预先安装.
(相反,通过区域设置/文化="nofollow noreferrer">
Set-Culture
不需要重新启动/注销并重新启动-只需启动新的PowerShell会话.)During my tinkering with PS 5.1 under Win 10, related to the objective of question Fully change language for the current PowerShell session I came across a couple of related questions.
Where is the Windows setting associated with the UICulture? I did not find "the "Keyboard and Languages" tab of the "Region and Language" control panel" as indicated here.
Can this be persistently changed from within PS? All I found so far only persist in a session.
The setting Settings -> Time and Language -> Language -> Windows display language shows "Español (España)", and PS gives
> Get-UICulture ; [System.Threading.Thread]::CurrentThread.CurrentUICulture ; [CultureInfo]::CurrentUICulture ; LCID Name DisplayName ---- ---- ----------- 1033 en-US English (United States) 1033 en-US English (United States) 1033 en-US English (United States)
without any intervening changes and in a session just launched.
解决方案On Windows, the so-called Windows display language is a user-specific setting that is known as the UI culture in .NET and reflected:
in PowerShell in the automatic
$PSUICulture
variable or via the output from theGet-UICulture
cmdlet.in .NET in
[cultureinfo]::CurrentUICulture
(System.Globalization.CultureInfo.CurrentUICulture
)
Re 1., on Windows 10:
Using the GUI , open the Settings application (e.g., via Start Menu), go to category
Time & Language
, then click onLanguage
in the sidebar on the left.Shortcuts:
Open the Settings app quickly:
- Use keyboard shortcut WinKey-i.
- Run
start ms-settings:
(works fromcmd
too).
In Start Menu, simply type "Language" and select
Language Settings
from the result - this takes you directly to the relevant page in the Settings app.Run
intl.cpl
to open the legacyRegion
Control Panel applet and click on theLanguage preferences
link, which takes you to the relevant page in the Settings app.- Incidentally,
intl.cpl
lets you switch to a different locale, aka culture in .NET ($PSCulture
/Get-Culture
/[cultureinfo]::CurrentCulture
(System.Globalization.CultureInfo.CurrentCulture
))
- Incidentally,
Re 2.
You can programmatically change the current user's display language with the
Set-WinUILanguageOverride
cmdlet.Note that it requires at least Windows 8 / Windows Server 2012 and only takes effect after a reboot or after logging off and on again.
Also, the language targeted must have been previously installed.
(By contrast, changing the locale / culture via
Set-Culture
doesn't require rebooting / logging off and back on - it only requires starting a new PowerShell session.)这篇关于PowrShell UICulture与Windows设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 顺便说一句,
[cultureinfo]::CurrentUICulture
(.Time & Language,然后在左边.
快捷方式: