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

首頁 > 編程 > VBScript > 正文

VBS腳本使用WMI操作注冊表的代碼第1/2頁

2020-07-26 11:56:28
字體:
供稿:網(wǎng)友

oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath   

oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue   
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue   
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue   
oReg.SetBinaryValue HKEY_LOCAL_MACHINE,strPath,strValueName,uBinary   
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues   

oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath   
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName   

oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue   
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue   
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue   
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,uBinary   
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues   

'-------------------------------------------------------------------------------------------   

Const HKEY_CLASSES_ROOT = &H80000000   
Const HKEY_CURRENT_USER = &H80000001   
Const HKEY_LOCAL_MACHINE = &H80000002   
Const HKEY_USERS = &H80000003   
Const HKEY_CURRENT_CONFIG = &H80000005   

' 創(chuàng)建注冊表項   
const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set StdOut = WScript.StdOut   
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/System Admin Scripting Guide"  
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath   

'創(chuàng)建多字符串值   
const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/System Admin Scripting Guide"  
strValueName = "Multi String Value Name"  
arrStringValues = Array("first string", "second string",_   
 "third string", "fourth string")   
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_   
strValueName,arrStringValues   

  
'創(chuàng)建擴展的字符串值   
const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/System Admin Scripting Guide"  
strValueName = "Expanded String Value Name"  
strValue = "%PATHEXT%"  
oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue   

'創(chuàng)建字符串和 DWORD 值   
const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set StdOut = WScript.StdOut   
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/System Admin Scripting Guide"  
strValueName = "String Value Name"  
strValue = "string value"  
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue   
strValueName = "DWORD Value Name"  
dwValue = 82   
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue   

  

'刪除注冊表項   

const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/System Admin Scripting Guide"  
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath   

  
'刪除注冊表值   

const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/System Admin Scripting Guide"  
strDWORDValueName = "DWORD Value Name"  
strExpandedStringValueName = "Expanded String Value Name"  
strMultiStringValueName = "Multi String Value Name"  
strStringValueName = "String Value Name"  
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName   
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strExpandedStringValueName   
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strMultiStringValueName   
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName   

  
'枚舉注冊表值和類型   
'枚舉子項   
'列出注冊表文件   
'監(jiān)視注冊表子項事件   
'監(jiān)視注冊表子樹事件   
'讀取二進制注冊表值   

const HKEY_LOCAL_MACHINE = &H80000002   
strComputer = "."  
Set StdOut = WScript.StdOut   
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_    
strComputer & "/root/default:StdRegProv")   
strKeyPath = "SOFTWARE/Microsoft/Windows NT/CurrentVersion"  
strValueName = "LicenseInfo"  
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_   
strValueName,strValue   
For i = lBound(strValue) to uBound(strValue)   
    StdOut.WriteLine  strValue(i)   
Next   
  

12下一頁閱讀全文
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 彝良县| 河间市| 中宁县| 阳原县| 左云县| 宁蒗| 天台县| 林西县| 华阴市| 新建县| 华坪县| 格尔木市| 桐庐县| 登封市| 博野县| 恩施市| 钟祥市| 咸宁市| 汉川市| 潜江市| 始兴县| 黎川县| 晋江市| 忻州市| 丰顺县| 阜康市| 淮北市| 两当县| 怀远县| 治多县| 阜新市| 龙川县| 息烽县| 平山县| 依兰县| 依安县| 梓潼县| 铁岭县| 宜丰县| 黄浦区| 新田县|