在批处理文件中使用WMIC卸载程序

时间:2018-01-30 17:45:43

标签: batch-file wmic

我正在编写一个卸载程序的脚本。我正在利用WMIC来做这件事。当我运行脚本时,它会在运行wMIC命令后立即停止。手动运行时一切正常。我的脚本看起来像这样:

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

为了继续剧本,我应该在“WMIC”之后添加什么?

手动输入时此脚本有效:

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

1 个答案:

答案 0 :(得分:1)

尝试使用:

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

如果这不起作用,那么可能会这样:

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

如果Echo Y|不起作用,那么您可能只需将其删除并接受是/否提示或找到其他卸载方法。