我有一个运行.reg文件的VBScript(这样做是为了使用户看不到它在运行)

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "regedit /s C:\Users\John\Desktop\OpenPorts.reg" ,1 ,True
Set WshShell = Nothing

然后运行下面的.reg文件
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR]
"Start" == dword:00000003

是否可以将此过程组合到1个不使用.reg文件即可进行更改的VBScript中?

最佳答案

这应该工作:

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\services\USBSTOR\Start", 3, "REG_DWORD"

关于registry - 使用auturn编写脚本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25762652/

10-09 15:52