我正在尝试获取VBScript来卸载软件。当我运行它时,它似乎只处理第一次命中,然后结束。它没有循环遍历strPublisher中的每个sMatch实例,这有什么错吗?
sMatch = "Mitel Networks Corporation"
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set WshShell = CreateObject("Wscript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strPublisher = ""
strPublisher = WshShell.RegRead ("HKLM\" & strKeyPath & "\" & subkey & "\Publisher")
If InStr(1, strPublisher, sMatch) >0 Then
WshShell.Run "cmd /c C:\Windows\System32\msiexec.exe /X" & SubKey & " /L*V msilog.txt", 1, True
WScript.Sleep 50000
End If
Next谢谢!
发布于 2019-11-03 22:14:24
注释掉:
on error resume next and you might get an error leading to the issue. What error do you get?https://stackoverflow.com/questions/58613630
复制相似问题