加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – powershell:改变当前会话的文化

发布时间:2020-12-14 04:09:30 所属栏目:Windows 来源:网络整理
导读:我在 windows vista上使用powershell. 如何改变当前会话的文化? 我的计算机文化是tr-TR所以我收到土耳其语的错误消息.我想改成EN? 任何机会? 看看这里: http://blogs.msdn.com/b/powershell/archive/2006/04/25/583235.aspx 这里:http://poshcode.org/2
我在 windows vista上使用powershell.
如何改变当前会话的文化?
我的计算机文化是tr-TR所以我收到土耳其语的错误消息.我想改成EN?

任何机会?

看看这里: 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值.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读