查看windows 启动run程序。
脚本说明:
H80000002 表示HKEY_LOCAL_MACHINE
行尾_ 表示连接下行
Code
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
For i=0 To UBound(arrValueNames)
Wscript.Echo "File Name: " & arrValueNames(i)
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath, _
arrValueNames(i),strValue
Wscript.Echo "Location: " & strValue
Next
删除某项:
假设run下创建了项abc,删除该项:
Code
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run\abc"
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
更多参考微软官方:
http://www.microsoft.com/china/technet/community/columns/scripts/sg0605.mspx