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%"
'字符串數(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%"
'字符串數(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基礎(chǔ)篇 - vbscript TextStream對象
TextStream對象是用于訪問文本文件的對象,它是FileSystemObject一個獨立的附屬對象,但在使用TextStream對象時,我們?nèi)砸柚鶩ileSystemObject 對象或其附屬對象來創(chuàng)建一個 TextStream 對象并訪問磁盤文件的內(nèi)容,需要的朋友可以參考下2018-06-06
使用 Iisext.vbs 啟用Web服務(wù)擴展文件的方法
這篇文章主要介紹了如何使用 iisext.vbs 在本地或遠程計算機上啟用 Web 服務(wù)擴展文件,需要的朋友可以參考下2014-07-07
用vbs實現(xiàn)顯示系統(tǒng)調(diào)色板的代碼
用vbs實現(xiàn)顯示系統(tǒng)調(diào)色板的代碼...2007-10-10
VBS教程:函數(shù)-DateSerial 函數(shù)
VBS教程:函數(shù)-DateSerial 函數(shù)...2006-11-11

