Uninstall a program using batch script

Here is a basic script that will uninstall a program in Windows 10, make sure you know the exact name of the program.

@echo off

REM Set the name of the program to be uninstalled
set PROGRAM_NAME="MyProgram"

REM Uninstall the program
wmic product where "name like '%PROGRAM_NAME%'" call uninstall

REM Check if the uninstallation was successful
if %ERRORLEVEL% NEQ 0 (
  echo Uninstallation failed.
) else (
  echo Uninstallation was successful.
)

This script will use the wmic command to uninstall the program with the specified name. It will then check the exit code to determine if the uninstallation was successful.

You can modify this script to customize it for your specific needs. For example, you can add additional criteria to the wmic command to make sure that the correct program is uninstalled.

Leave a Comment

Your email address will not be published. Required fields are marked *