vbscript 注冊表腳本書寫
更新時間:2008年06月15日 20:46:46 作者:
用vbscript實現(xiàn)的修改注冊表的腳本,建議大家看看
WScript.Echo "Enabling Kerberos Logging..."
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
'===============================================================================
'創(chuàng)建項的位置
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'啟動創(chuàng)建項目的類型
'=====================================1'REG_SZ 字符串值==========================================
strValueName = "SysExplr"
'創(chuàng)建字符串的名稱
strValue = "d:\\Herosoft\\HeroV8\\SYSEXPLR.EXE"
'創(chuàng)建字符串的數(shù)據(jù)
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'所創(chuàng)建的類型字符串
'=====================================2.REG_DWORD DWORD值===========================================
strValueName = "DWORD Value Name"
'創(chuàng)建DWORD名稱
dwValue = 82
'創(chuàng)建DWORD數(shù)據(jù)
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
'所創(chuàng)建類型DWORD
'=======================================3.REG_EXPAND_SZ 可擴充字符串值=========================================
strValueName = "Expanded String Value Name"
'創(chuàng)建擴充字符串名稱
strValue = "%PATHEXT%"
'字符串?dāng)?shù)據(jù)
oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'所創(chuàng)建類型為擴充字符串
'========================================4.REG_MULTI_SZ 多字符串值=========================================
strValueName = "Multi String Value Name"
'創(chuàng)建多字符串名稱
arrStringValues = Array("first string", "second string","third string", "fourth string")
'創(chuàng)建多字符串值
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues
'所創(chuàng)建類型為多字符串值
'======================================================================================
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
WScript.Echo "-=[Complete!]=-"
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
'===============================================================================
'創(chuàng)建項的位置
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'啟動創(chuàng)建項目的類型
'=====================================1'REG_SZ 字符串值==========================================
strValueName = "SysExplr"
'創(chuàng)建字符串的名稱
strValue = "d:\\Herosoft\\HeroV8\\SYSEXPLR.EXE"
'創(chuàng)建字符串的數(shù)據(jù)
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'所創(chuàng)建的類型字符串
'=====================================2.REG_DWORD DWORD值===========================================
strValueName = "DWORD Value Name"
'創(chuàng)建DWORD名稱
dwValue = 82
'創(chuàng)建DWORD數(shù)據(jù)
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
'所創(chuàng)建類型DWORD
'=======================================3.REG_EXPAND_SZ 可擴充字符串值=========================================
strValueName = "Expanded String Value Name"
'創(chuàng)建擴充字符串名稱
strValue = "%PATHEXT%"
'字符串?dāng)?shù)據(jù)
oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'所創(chuàng)建類型為擴充字符串
'========================================4.REG_MULTI_SZ 多字符串值=========================================
strValueName = "Multi String Value Name"
'創(chuàng)建多字符串名稱
arrStringValues = Array("first string", "second string","third string", "fourth string")
'創(chuàng)建多字符串值
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues
'所創(chuàng)建類型為多字符串值
'======================================================================================
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
WScript.Echo "-=[Complete!]=-"
相關(guān)文章
用VBS實現(xiàn)的發(fā)送帶Cookie的HTTP請求的代碼
在昨天的《使用正確版本的XMLHTTP》中賣了個關(guān)子,ServerXMLHTTP的功能比XMLHTTP強大,你現(xiàn)在大概已經(jīng)猜到了吧。沒錯,用ServerXMLHTTP可以在HTTP請求頭中加入Cookie,而XMLHTTP不可以2013-01-01VBS 腳本不能運行 提示W(wǎng)indows無法訪問指定設(shè)備路徑或文件
Windows無法訪問指定設(shè)備路徑或文件,您可能沒有合適的權(quán)限訪問這個項目.2009-10-10vbs 調(diào)用中文語音讓你電腦聽你的命令的實現(xiàn)代碼
關(guān)于vbs調(diào)用中文語音讓你電腦聽你的命令的實現(xiàn)代碼,需要的朋友可以參考下。2009-10-10