How to Uninstall Programs in Batch Script

MD Aminul Islam Feb 02, 2024
How to Uninstall Programs in Batch Script

We uninstall unnecessary programs manually by the Windows Control Panel or other trusted third-party software. But we can also create a Batch script that uninstalls specific programs from the system.

This article will show how we can create a Batch file to uninstall unnecessary programs from our system. We will also see necessary examples and explanations to make it easier to understand.

Uninstall Programs in Batch Script

The keyword WMIC can call the uninstall command. It is the abbreviation of the WMI (Windows Management Interface) command.

It is a simple command prompt tool that returns necessary information about the system.

WMIC is the extended and updated version of WMI. It also can control running programs and perform necessary system operations.

The general format for the command is:

WMIC product WHERE name="NAME OF YOUR PROGRAM" CALL uninstall

To uninstall a program from the system, follow the example below.

WMIC product WHERE name="Notepad++" CALL uninstall
Y

In the above example, we are uninstalling Notepad++ from our system. You can notice that we used the symbol Y; the purpose of this symbol is to continue the process.

You also can combine the whole command with ECHO. To do this, we can convert the above example code, as shown below.

Echo Y|WMIC product WHERE name="Notepad++" CALL uninstall

In the above way, you do not need to provide the symbol Y separately. Here, you need to provide the exact name of the application or program; otherwise, the command will not succeed.

The CALL function is used to call the uninstall. If the application name is correct and there is no error in the command, it will install the application specified by the command.

MD Aminul Islam avatar MD Aminul Islam avatar

Aminul Is an Expert Technical Writer and Full-Stack Developer. He has hands-on working experience on numerous Developer Platforms and SAAS startups. He is highly skilled in numerous Programming languages and Frameworks. He can write professional technical articles like Reviews, Programming, Documentation, SOP, User manual, Whitepaper, etc.

LinkedIn

Related Article - Batch Program