在批处理文件中使用WMIC卸载程序 [英] Using WMIC in a batch file to uninstall a program

查看:677
本文介绍了在批处理文件中使用WMIC卸载程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写脚本来卸载程序.我正在利用WMIC来做到这一点.当我运行脚本时,它会在运行wMIC命令后立即停止.手动运行时,一切正常.我的脚本如下:

I am writing a script to uninstall a program. I am utilizing WMIC to do this. When I run the script, it stops immediately after the wMIC command is run. When run it manually everything works fine. My script looks like this:

@echo off
title Forcepoint DLP Endpoint
Echo Forcepoint DLP Endpoint
wmic
product where name="Forcepoint DLP Endpoint" call uninstall /nointeractive

在"WMIC"之后,我应该添加什么以继续执行脚本?

What should I be added after "WMIC" in order to continue the script?

此脚本在手动输入后有效:

wmic
product where name="Forcepoint DLP Endpoint" call uninstall
Y

推荐答案

尝试使用:

@Echo Off
Title Forcepoint DLP Endpoint
Echo Forcepoint DLP Endpoint
WMIC Product Where "Name='Forcepoint DLP Endpoint'" Call Uninstall /NoInteractive

如果这不起作用,则可能是这样:

If that doesn't work then perhaps this might:

@Echo Off
Title Forcepoint DLP Endpoint
Echo Forcepoint DLP Endpoint
Echo Y|WMIC Product Where "Name='Forcepoint DLP Endpoint'" Call Uninstall

如果Echo Y|不起作用,则可能只需要删除它并接受是/否提示,或者找到另一种卸载方法.

If the Echo Y| doesn't work then you may just have to remove it and accept the yes/no prompt or find another method of uninstall.

这篇关于在批处理文件中使用WMIC卸载程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆