peiyuan1030 发表于 2018-6-23 15:02:20

rem windows服务器时间同步

rem windows服务器时间同步  
rem 如果游戏进程存在则退出
  
echo "%date%%time% ntp start" >> c:\ntp.log
  
tasklist|find /i "Goddess" && exit 1
  
tasklist|find /i "Bishop" && exit 1
  
tasklist|find /i "Relay" && exit 1
  
tasklist|find /i "Router" && exit 1
  
::::::::
  
rem 若时间服务器已设置则直接同步
  
net time /QUERYSNTP |find "cn.pool.ntp.org,0x1 ntp.nasa.gov,0x1 ntp.api.bz,0x1 time.windows.com,0x1 210.72.145.440x1"
  
if %errorlevel% equ 0 (
  w32tm /resync /nowait /rediscover
  echo "%date%%time% ntp success" >> c:\ntp.log
  
) else (
  net time /setsntp:"cn.pool.ntp.org,0x1 ntp.nasa.gov,0x1 ntp.api.bz,0x1 time.windows.com,0x1 210.72.145.440x1"
  
::net stop w32time
  
::net start w32time
  w32tm /resync /nowait /rediscover
  echo "%date%%time% ntp success" >> c:\ntp.log
  
)
  
exit 0
页: [1]
查看完整版本: rem windows服务器时间同步