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!]=-"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.