vbscript 註冊表指令碼書寫_vbs
來源:互聯網
上載者:User
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"
'===============================================================================
'建立項的位置
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'啟動建立項目的類型
'=====================================1'REG_SZ 字串值==========================================
strValueName = "SysExplr"
'建立字串的名稱
strValue = "d:\\Herosoft\\HeroV8\\SYSEXPLR.EXE"
'建立字串的資料
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'所建立的類型字串
'=====================================2.REG_DWORD DWORD值===========================================
strValueName = "DWORD Value Name"
'建立DWORD名稱
dwValue = 82
'建立DWORD資料
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
'所建立類型DWORD
'=======================================3.REG_EXPAND_SZ 可擴充字串值=========================================
strValueName = "Expanded String Value Name"
'建立擴充字串名稱
strValue = "%PATHEXT%"
'字串資料
oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'所建立類型為擴充字串
'========================================4.REG_MULTI_SZ 多字串值=========================================
strValueName = "Multi String Value Name"
'建立多字串名稱
arrStringValues = Array("first string", "second string","third string", "fourth string")
'建立多字串值
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues
'所建立類型為多字串值
'======================================================================================
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
WScript.Echo "-=[Complete!]=-"