- @echo off
- pushd %tmp%
- (
- echo Randomize
- echo With CreateObject("Microsoft.XMLHTTP"^)
- echo .open "get","http://open.baidu.com/special/time/?"^&Rnd*1e15,False
- echo .send
- echo t=DateAdd("s",CLng(Left(Split(.responseText,"baidu_time("^)(1^),10^)^),"1970-1-1 8:00"^)
- echo WScript.echo right(year(t^),4^) ^& right("0" ^& month(t^),2^) ^& right("0" ^& day(t^),2^),Hour(t^)^&":"^&Minute(t^)^&":"^&Second(t^)
- echo End With
- )>gettime.vbs
- for /f "tokens=1*" %%i in ('cscript //nologo gettime.vbs') do date %%i&time %%j&set "日期=%%i"
- set 日期
- popd
- pause
复制代码
|