gpt4 book ai didi

windows - 电源外壳 : changing the culture of current session

转载 作者:可可西里 更新时间:2023-11-01 12:42:52 25 4
gpt4 key购买 nike

我在 windows vista 上使用 powershell。如何更改当前 session 的文化?我的计算机的文化是 tr-TR,所以我收到土耳其语的错误消息。我想换成英文?

有机会吗?

最佳答案

看看这里:http://blogs.msdn.com/b/powershell/archive/2006/04/25/583235.aspx

这里:http://poshcode.org/2226 :

function Set-Culture([System.Globalization.CultureInfo] $culture)
{
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
[System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
}

附加信息

要找到哪些值可以用于 $culture:

  • 这将为您提供文化类型列表:

    [Enum]::GetValues([System.Globalization.CultureTypes])
  • 选择上述类型之一(例如 AllCultures),然后您可以列出该类型的可用值:

    [System.Globalization.CultureInfo]::GetCultures( [System.Globalization.CultureTypes]::AllCultures )
  • 然后您可以通过 GetCultureInfo 方法使用您感兴趣的文化的名称或编号来检索您想要的值:

    $culture = [System.Globalization.CultureInfo]::GetCultureInfo(1033)
    $culture = [System.Globalization.CultureInfo]::GetCultureInfo('en-US')

注意:由于隐式转换,您只需将区域性名称或数字(即作为字符串或整数)传递给 Set-Culture 方法,该方法将自动转换为预期的 CultureInfo 值.

关于windows - 电源外壳 : changing the culture of current session,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7052765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com