简体   繁体   中英

Using WMIC in a batch file to uninstall a program

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

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

This script when entered manually worked:

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

Try using:

@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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM