| @echo off | | cls | | color 2f | | cd /d %~dp0 | | Echo.&&Echo.正在与Internet时间服务器同步……&&Echo.=================================================== | | wget -N http://weasel.jgxx.com/wsqbbs/time.php >nul 2>nul | | title 瓦斯曲-同步时间服务器工具 | | for /f "tokens=1,2 " %%i in (time.php) do date %%i &&time %%j | | for /f "tokens=1,2 " %%i in (time.php) do echo 同步成功!!&& echo 服务器日期 %%i 系统日期 %date% &&echo 服务器时间 %%j 系统时间 %time% | | del /f /s /q time.php >nul 2>nul | | Echo.==================================================&&Echo.按任意键退出!!&&pause>nul 2>nulCOPY |
| @echo off | | wget -N http://www.appinn.com/servertime.php | | for /f "tokens=1,2 " %%i in (servertime.php) do date %%i &&time %%jCOPY |
| | | | | function getServerDate(serverHttpAddress, httpProxyAddress) | | { | | var xmlHttp = new ActiveXObject("msxml2.xmlhttp"); | | if(httpProxyAddress) | | { | | setProxy(2,proxyHttpAddress.replace("http://","")); | | } | | xmlHttp.open("GET", serverHttpAddress, 0); | | ts=(new Date()).getTime(); | | WScript.Echo("Start time: " + ts); | | xmlHttp.send(); | | tr=new Date(); | | WScript.Echo("End time: " + tr.getTime()); | | WScript.Echo("Server Time: " + Date.parse( xmlHttp.getResponseHeader('Date'))); | | | | tr.setTime(Date.parse( xmlHttp.getResponseHeader('Date')) + ((new Date()).getTime() - ts)/2); | | | | WScript.Echo("debug time: " + tr) | | return tr; | | | | | | | | | | | | } | | | | | | | | | | | | function setSystemDate(dateString) | | { | | WScript.Echo("End time: " + dateString); | | var oSvc = GetObject("winmgmts:\\\\.\\root\\cimv2"); | | oSvc.Security_.Privileges.AddAsString("SeSystemTimePrivilege", 1); | | var e = new Enumerator(oSvc.execQuery("select * from win32_OperatingSystem", "WQL", 32)); | | | | } | | | | | | with(getServerDate("http://www.google.com/")) | | { | | setSystemDate("" + | | getUTCFullYear() + | | (getUTCMonth()<9?"0"+(getUTCMonth()+1):(getUTCMonth()+1)) + | | (getUTCDate()<9?"0"+getUTCDate():getUTCDate()) + | | (getUTCHours()<9?"0"+getUTCHours():getUTCHours()) + | | (getUTCMinutes()<9?"0"+getUTCMinutes():getUTCMinutes()) + | | (getUTCSeconds()<9?"0"+getUTCSeconds():getUTCSeconds()) + | | ".******+***"); | | }COPY |
|