首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >卸载软件的VBScript

卸载软件的VBScript
EN

Stack Overflow用户
提问于 2019-10-30 02:46:07
回答 1查看 168关注 0票数 0

我正在尝试获取VBScript来卸载软件。当我运行它时,它似乎只处理第一次命中,然后结束。它没有循环遍历strPublisher中的每个sMatch实例,这有什么错吗?

代码语言:javascript
复制
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

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2019-11-03 22:14:24

注释掉:

代码语言:javascript
复制
 on error resume next and you might get an error leading to the issue. What error do you get?
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58613630

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档