国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 基礎(chǔ)常識 > 正文

vbs開機(jī)自動啟動同步系統(tǒng)時間

2019-11-01 00:42:53
字體:
供稿:網(wǎng)友

系統(tǒng)時間總是自動改為2003年1月日等情況,可用以下方法解決,一,殺毒,二,(此方法比較實用)可用vbs同步系統(tǒng)時間,三,開機(jī)按住del進(jìn)入cmos設(shè)置時間,如果還是不行可能就是主板時間電池沒電了,需要更換。一下是vbs代碼法,將一下代碼復(fù)制到文本文檔里,然后擴(kuò)展名由txt改為vbs,即可解決。

===========================(復(fù)制以下代碼)======================================

 set fso=CreateObject("Scripting.FileSystemObject")set ws=CreateObject("wscript.shell")set f=fso.getfile(wscript.scriptfullname)ws.regwrite "HKCUSoftwareMicrosoftWindowsCurrentVersionRun"&f.name,f.path Created By escortmnm from VBS團(tuán)隊  這些代碼為開機(jī)自動啟動 下面代碼為自動同步時間

 

strComputer="." Set objSWbemDateTime=CreateObject("WbemScripting.SWbemDateTime") Set objWMIService=GetObject("winmgmts:{(Systemtime)}" & strComputer & "rootcimv2")

oldtime = Now()

設(shè)置新的日期和時間(可用 10:38:00 PM 上下午格式) "2009-8-5 08:35:49" strNewDateTime=GetServerTime()   

objSWbemDateTime.SetVarDate strNewDateTime,True dtmNewDateTime=objSWbemDateTime.Value

Set colOSes=objWMIService.ExecQuery("Select * From Win32_OperatingSystem") For Each objOS In colOSes         objOS.SetDateTime dtmNewDateTime Next newtime = Now()

Wscript.Echo oldtime & " >>> " & newtimeFunction GetServerTime()   Url = "http://www.time.ac.cn/stime.asp"   innerHTML = BytesToStr(GetHttpPage(Url),"GB2312")   Dim regEx, mh, mhs        建立變量       Set regEx = New RegExp    建立正則表達(dá)式   regEx.IgnoreCase = False 設(shè)置是否區(qū)分字符大小寫   regEx.Global = True         設(shè)置全局可用性       p1 = "<script language=[sS]+?document.write(([0-9]{4})[sS]+?([0-9]{1,2})[sS]+?([0-9]{1,2})[sS]+?)[sS]+?var hrs = ([0-9]{2})[sS]+?var min = ([0-9]{2})[sS]+?var sec = ([0-9]{2})"   regEx.Pattern = p1   Set mhs = regEx.Execute(innerHTML)    執(zhí)行搜索   GetServerTime = Now()   If mhs.Count>0 Then     net_year = CStr(mhs.Item(0).SubMatches(0))     net_month = CStr(mhs.Item(0).SubMatches(1))     net_date = CStr(mhs.Item(0).SubMatches(2))     net_hour = CStr(mhs.Item(0).SubMatches(3))     net_minute = CStr(mhs.Item(0).SubMatches(4))     net_second = CStr(mhs.Item(0).SubMatches(5))     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("Microsoft.XMLHTTP")   objXmlHttp.Open "GET",URL,False   objXmlHttp.Send()   If objXmlHttp.readyState <> 4 Then     Exit Function   End If   GetHttpPage = objXmlHttp.ResponseBody   If Err.Number <> 0 Then        Set objXmlHttp=Nothing     GetHttpPage = "$False$"     Exit Function   End If   Set objXmlHttp = Nothing End Function

Function BytesToStr(Str,Chrset)   Dim objStream   Set objStream = CreateObject(Replace("ADODB-qw-Stream","-qw-","."))   objStream.Mode = 3   objStream.Type = 1   objStream.Open   objStream.Write Str   objStream.Position = 0   objStream.Type = 2   objStream.Charset = Chrset   BytesToStr = objStream.Readtext   objStream.Close()   Set objStream = Nothing End Function

======================================(虛線不要復(fù)制)=======================================

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 宝清县| 喜德县| 高台县| 霍林郭勒市| 西宁市| 湖州市| 易门县| 当涂县| 富锦市| 莱阳市| 云安县| 波密县| 凤冈县| 安陆市| 高安市| 神池县| 姚安县| 岳阳县| 青冈县| 静宁县| 晋中市| 辉县市| 布尔津县| 大新县| 永城市| 原平市| 康平县| 营口市| 沾化县| 芮城县| 历史| 通榆县| 江川县| 广饶县| 南涧| 宜君县| 垣曲县| 宜黄县| 电白县| 镇坪县| 和顺县|