系统时间总是自动改为年月日等情况可用以下方法解决一杀毒二(此方法比较实用)可用vbs同步系统时间三开机按住del进入cmos设置时间如果还是不行可能就是主板时间电池没电了需要更换一下是vbs代码法将一下代码复制到文本文档里然后扩展名由txt改为vbs即可解决 ===========================(复制以下代码)====================================== set fso=CreateObject("ScriptingFileSystemObject") set ws=CreateObject("wscriptshell") set f=fsogetfile(wscriptscriptfullname) wsregwrite "HKCUSoftwareMicrosoftWindowsCurrentVersionRun"&fnamefpath Created By escortmnm from VBS团队 这些代码为开机自动启动 下面代码为自动同步时间 strComputer="" Set objSWbemDateTime=CreateObject("WbemScriptingSWbemDateTime") Set objWMIService=GetObject("winmgmts:{(Systemtime)}" & strComputer & "rootcimv") oldtime = Now() 设置新的日期和时间(可用 :: PM 上下午格式) " ::" strNewDateTime=GetServerTime() objSWbemDateTimeSetVarDate strNewDateTimeTrue dtmNewDateTime=objSWbemDateTimeValue Set colOSes=objWMIServiceExecQuery("Select * From Win_OperatingSystem") For Each objOS In colOSes objOSSetDateTime dtmNewDateTime Next newtime = Now() WscriptEcho oldtime & " >>> " & newtime Function GetServerTime() Url = " innerHTML = BytesToStr(GetHttpPage(Url)"GB") Dim regEx mh mhs 建立变量 Set regEx = New RegExp 建立正则表达式 regExIgnoreCase = False 设置是否区分字符大小写 regExGlobal = True 设置全局可用性 p = "<script language=[sS]+?documentwrite(([]{})[sS]+?([]{})[sS]+?([]{})[sS]+?)[sS]+?var hrs = ([]{})[sS]+?var min = ([]{})[sS]+?var sec = ([]{})" regExPattern = p Set mhs = regExExecute(innerHTML) 执行搜索 GetServerTime = Now() If mhsCount> Then net_year = CStr(mhsItem()SubMatches()) net_month = CStr(mhsItem()SubMatches()) net_date = CStr(mhsItem()SubMatches()) net_hour = CStr(mhsItem()SubMatches()) net_minute = CStr(mhsItem()SubMatches()) net_second = CStr(mhsItem()SubMatches()) GetServerTime = net_year & "" & net_month & "" & net_date & " " & net_hour & ":" & net_minute & ":" & net_second End If End Function Function GetHttpPage(URL) On Error Resume Next Set objXmlHttp = CreateObject("MicrosoftXMLHTTP") objXmlHttpOpen "GET"URLFalse objXmlHttpSend() If objXmlHttpreadyState <> Then Exit Function End If GetHttpPage = objXmlHttpResponseBody If ErrNumber <> Then Set objXmlHttp=Nothing GetHttpPage = "$False$" Exit Function End If Set objXmlHttp = Nothing End Function Function BytesToStr(StrChrset) Dim objStream Set objStream = CreateObject(Replace("ADODBqwStream""qw""")) objStreamMode = objStreamType = objStreamOpen objStreamWrite Str objStreamPosition = objStreamType = objStreamCharset = Chrset BytesToStr = objStreamReadtext objStreamClose() Set objStream = Nothing End Function ======================================(虚线不要复制)======================================= |