我有这个VBScript:
On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
myKey = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRunexample"
WshShell.RegWrite myKey, "C:Program Files (x86)example.exe", "REG_SZ"
Set WshShell = Nothing
它增加了
"C:\Program Files(x86(\example.exe">
到启动注册表
"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\example">
现在我还想添加
"C:\Program Files(x86(\example.exe">
到启动注册表
"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\example">
如何在一个单独的VBScript中做到这一点?
我试图修改这个代码:
On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
myKey = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRunexample"
WshShell.RegWrite myKey, "C:Program Files (x86)example.exe", "REG_SZ"
Set WshShell = Nothing
这样它就可以将程序添加到HKEY_LOCAL_MACHINE
中,然后将其粘贴到下面,但这并没有奏效。
Dim wshShell
Dim myKey
Set wshShell = CreateObject("WScript.Shell")
myKey = "HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionRunexample"
wshShell.RegWrite myKey, "C:Program Files (x86)example.exe", "REG_SZ"