更改Windows时间和日期格式

p.c*_*ell 6 powershell

我想在Windows机器上自动化首选项,以获取整个操作系统中使用的日期和时间格式.

我可以使用哪些PowerShell命令来自动执行更改值的任务?

  • 短日期格式
  • 短期和长期格式

这些选项深埋在控制面板中.

在此输入图像描述

在此输入图像描述

小智 8

我相信您要查找的设置位于:

HKEY_CURRENT_USER\Control Panel\International\sLongDate
HKEY_CURRENT_USER\Control Panel\International\sShortDate
HKEY_CURRENT_USER\Control Panel\International\sTimeFormat
HKEY_CURRENT_USER\Control Panel\International\sYearMonth
Run Code Online (Sandbox Code Playgroud)

所以,

Set-ItemProperty -Path "HKCU:\Control Panel\International" 
                 -name sLongDate -value "<Whatever format you'd like>"
Run Code Online (Sandbox Code Playgroud)