相关疑难解决方法(0)

用于将 Windows 操作系统时钟同步到 NTP 服务器的便携式命令行

最近(这个千年)版本的 Windows 是否有一种“便携式”方式来强制 NTP 同步?

在 Windows 7 上,甚至还有先决条件——服务Windows Time需要运行。

(单击任务栏中的时间?更改日期和时间设置...?选择Internet 时间选项卡?更改设置?勾选同步...复选框。这将启动Windows Time服务)。

之后,从提升的命令提示符,我可以执行以下操作:

> w32tm /resync
Sending resync command to local computer
The command completed successfully.

>
Run Code Online (Sandbox Code Playgroud)

...但我不认为这是向后兼容的。Windows XP记录方式使用net time

> net time /setsntp
Run Code Online (Sandbox Code Playgroud)

...但在 Windows 7 上,这给出了错误消息:

The /QUERYSNTP and /SETSNTP options have been deprecated. Please use w32tm.exe
to configure the Windows Time Service.
Run Code Online (Sandbox Code Playgroud)

那么,无论 Windows 版本如何,有没有办法做到这一点?(如果不能用简单的命令完成,那么也许可以通过编程来完成?)

windows command-line ntp

6
推荐指数
1
解决办法
3万
查看次数

标签 统计

command-line ×1

ntp ×1

windows ×1