How can I change a Windows user's regional settings/date format?

前端 未结 4 1489
独厮守ぢ
独厮守ぢ 2020-12-21 00:19

I use a VB6/COM+ application which outputs date/time values based on the short date settings in the Control Panel, Regional Settings, for the user that runs it. The program

4条回答
  •  一个人的身影
    2020-12-21 00:43

    While persistently changing a user's culture (regional settings) is to be done cautiously, there are legitimate use cases.

    On Windows 8 and Windows Server 2012 and above, Windows PowerShell comes with the
    Set-Culture cmdlet, which is the programmatic equivalent of choosing a different region via Control Panel (intl.cpl).

    For instance, Set-Culture fr-CA is the equivalent of interactively choosing region French (Canada) for the current user.

    Caveat: Mixed cultures such as en-DE (sic) appear not to work as of Windows PowerShell v5.1 - see this answer of mine.

    While it won't be fast, it is possible to call PowerShell commands from C#.

提交回复
热议问题