Is there a way I can uninstall programs without the graphical interface and doing it via CMD?

8 Answers 8


Every program that properly installs itself according to Microsoft's guidelines makes a registry entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall. Usually, the key for the program will be its GUID, or else the name of the program. Within that key will be an entry called UninstallString. This contains the command to execute to uninstall the program.

If you already know ahead of time what you will be uninstalling, it should be easy enough to just put that in your batch file. It gets tricky when you try to automate that process though. You can use the reg command to get data from the registry, but it returns a lot of text around the actual value of a given key, making it hard to use. You may want to experiment with using VBscript or PowerShell, as they have better options for getting data from the registry into a variable.


You can invoke the correct uninstaller without knowing the GUID, etc. by using WMIC.

To see a list of the names of the programs as known internally by Windows:

wmic product get name

Look for your product name. It probably matches the one listed in the "Programs and Features" control panel, but not always.

Then you can use

wmic product where name="_my_product_name" call uninstall

to perform the uninstall, which AFAIK should be silent (it has been in my experience, but try it before you bet the farm on that. Silence may depend on how your installer/uninstaller was built).

See here for more:

There's also reference documentation for WMIC on microsoft.com.

  • 2
    You can run this against remote computers by adding /node:"<ComputerName>" ex: wmic /node:"someuser-pc" product get name. Be sure that you use "" around the name or you will run into the "Invalid Global Switch" error. Also be sure you run this from a CMD prompt and not a PowerShell prompt as the "" workaround for the "Invalid Global Switch" error doesn't work in the PowerShell prompt. Mar 5, 2015 at 14:53
  • 1
    Great answer, but small caveat is that WMIC can take a fair amount of time to execute a command. Listing products took about 3 minutes on my PC.
    – SmacL
    Mar 15, 2017 at 10:23
  • Duly noted, @SmacL. I have only had occasion to use this a few times, and depending on what's on your system I can believe it would take a while. Nov 26, 2019 at 8:59

If you have PowerShell 3 (or higher) installed, you can issue a WMI call to get all programs named a certain thing (or 'like' a certain thing, to do wildcard searches), and then call the Uninstall method for each of them:

(Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name like '%Partial Name%'").uninstall()


If a program uses Windows Installer, you can use one of the following commands:

msiexec /q /x <ProductCodeGuid>
msiexec /q /x <PathToMsi>

However, you're likely have neither the product code nor the original MSI file used for installation.

Other than that, there is no generic uninstall command, since installers that do not make use of Windows Installer are "unknown" by the operating system. They might supply their own uninstall executable, but whether that executable includes a way to run it without GUI depends on the individual software package.


If you know where the MSI installer file is you can use:

Msiexec /uninstall Application.msi /quiet


Check this out, this is using a batch find the software's UninstallString registry key and then uninstall the software silently which is much more reliable compare to wmic I found. https://community.spiceworks.com/topic/2143980-deploy-or-upgrade-java-8-via-shutdown-script-remove-old-javas

::It extracts software software GUID, then use the GUID to search the name and version
@echo off

set SoftwareName=Java 8
set NewVersion=8.0.1720.11
set x86GUID=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
set x64GUID=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

REM It's faster to first locate the software GUID, then search it's Name, Version & UninstallString
for /f "delims=" %%P in ('reg query "%x86GUID%" /s /f "%SoftwareName%" 2^>nul ^| findstr "HKEY_LOCAL_MACHINE"') do (
  echo %%P
  reg query "%%P" /v "DisplayVersion" 2>nul | findstr /r /c:"  %NewVersion%" >nul && (
    for /f "tokens=2*" %%A in ('reg query "%%P" /v "DisplayName" 2^>nul ^|findstr "DisplayName"') do echo %%B has already been installed
    for /f "tokens=2*" %%A in ('reg query "%%P" /v "DisplayVersion" 2^>nul ^|findstr "DisplayVersion"') do echo Version: %%B
    goto :EOF
  ) || (
    for /f "tokens=2*" %%A in ('reg query "%%P" /v "DisplayName" 2^>nul ^|findstr "DisplayName"') do echo Found other version %%B, upgrade in progress
    for /f "tokens=2*" %%A in ('reg query "%%P" /v "UninstallString" 2^>nul ^|findstr "UninstallString"') do (
      echo %%B | findstr /c:"MsiExec.exe"  >nul && (
        set MsiStr=%%B
        set MsiStr=!MsiStr:/I=/X!
        echo !MsiStr! /quiet /norestart
        !MsiStr! /quiet /norestart
        rem %Installer%
      ) || (
        echo None MsiExec Uninstall String %%B
        rem "%%B" /S
if not defined MsiStr (
  echo %SoftwareName% not found, install it?
  rem %Installer%


A VBScript script will help you to uninstall the require program.

To use this script you will require software name which is located in your registry.

Just enter the application name in the script and run it with admin privileges; it will uninstall the application. But this will only work for a window-based application; for standalone setup or apps which doesn't make an entry in the uninstall string of registry, the script will not work.

So in that case you will have to find another way to uninstall the application.


On error resume Next

Dim strName, WshShell, oReg, keyname

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

'Change the value here with DisplayName's value
strName = " "
Set WshShell = CreateObject("WScript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
    keyname = ""
       keyname = wshshell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & subkey & "\DisplayName")
    If keyname = strName then
        i = subkey
    End If

If i Then

    WshShell.Run "MSIEXEC.EXE /X " & i & " /QN", 1, True
End If

Set WshShell = Nothing
set ObjReg = Nothing


The correct answer is above, but for Windows X64 installs you will also need to check:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .