您可以使用以下的bat代码来获取互联网时间并更新系统时间:

@echo off

echo Getting internet time...
for /f 'tokens=*'' %%I in ('powershell -Command '(New-Object System.Net.WebClient).DownloadString('http://worldclockapi.com/api/json/utc/now') | ConvertFrom-Json | Select-Object -ExpandProperty currentDateTime'') do set 'internetTime=%%I'

echo Updating system time...
powershell -Command 'Set-Date -Date '%internetTime%' -Adjust'

echo Done.

将以上代码保存为一个.bat文件,然后运行它,它将获取互联网时间并更新系统时间。请注意,您的计算机需要连接到互联网才能成功获取互联网时间。

Windows 10 批处理脚本获取并更新系统时间

原文地址: https://www.cveoy.top/t/topic/Dns 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录