How to Uninstall a Program Through CMD
Introduction
When a graphical user interface (GUI) fails to launch, or you need to script a removal process for multiple machines, the Command Prompt (CMD) becomes a powerful ally. Using CMD to uninstall a program bypasses the need for third‑party tools and provides a direct line to the Windows Installer service. This article explains step‑by‑step how to uninstall a program via the command line, why the method works, and answers common questions that arise during the process. By the end, you will be able to remove any installed application confidently, whether you are a novice user or an IT professional.
Why Use CMD for Uninstallation?
- Automation – Scripts can loop through a list of programs and uninstall them without user interaction.
- Troubleshooting – If the “Add or Remove Programs” window is corrupted, CMD can still reach the underlying installer.
- Remote Management – Using tools like PsExec, you can execute uninstall commands on networked computers.
Understanding the underlying mechanism helps you choose the right command for each situation Worth keeping that in mind..
Prerequisites
- Administrator Rights – Most uninstall operations require elevated privileges. Right‑click the Command Prompt icon and select Run as administrator.
- Exact Program Name or Product Code – Knowing the exact display name or the Windows Installer product identifier (GUID) improves success rates.
- Backup (Optional) – While uninstalling is generally safe, backing up important data is always recommended.
Method 1: Using WMIC (Windows Management Instrumentation Command-line)
WMIC is a built‑in utility that queries and manipulates system objects, including installed Windows Installer packages That's the part that actually makes a difference..
Steps
-
Open CMD as Administrator.
-
List Installed Programs – Run the following command to see a list of display names and their GUIDs:
wmic product get name,identifyingnumberThe
identifyingnumbercolumn contains the GUID you will need for uninstallation. -
Uninstall the Target Program – Replace
ProgramNamewith the exact name you observed, or use the GUID directly:wmic product where "name='ProgramName'" call uninstallIf you have the GUID, use:
wmic product where "identifyingnumber='{GUID}'" call uninstall -
Confirm the Prompt – WMIC will ask “Are you sure you want to uninstall?” Respond with
Yand press Enter. -
Wait for Completion – The process may take a few seconds to a couple of minutes, depending on the program size.
Important Notes
- WMIC is deprecated in newer Windows 10/11 builds, but it still works on most systems.
- 64‑bit vs 32‑bit – Ensure you run the 64‑bit version of CMD on a 64‑bit OS to avoid mismatched registry views.
Method 2: Using the Windows Installer (MSI) Directly
Many programs install via an MSI package. The msiexec command can uninstall an MSI by its product code.
Steps
-
Locate the Product Code – Use the following command to retrieve all MSI product codes:
wmic product where "name like '%ProgramName%'" get identifyingnumberIf the program uses an MSI, the GUID shown is the product code.
-
Uninstall with MSIXEC – Replace
{GUID}with the actual code:msiexec /x {GUID} /qn/xspecifies the product to remove./qnruns the uninstall silently (no UI).
-
Verify Removal – Run
wmic product get name,identifyingnumberagain; the program should no longer appear.
When MSICUU or MSPatches Are Involved
Some applications use a combination of MSI and a separate patch file. In such cases, you may need to locate the patch’s ID and uninstall it first, then the main MSI Small thing, real impact..
Method 3: Using the Registry (Advanced)
If the above methods fail, the program’s entry may linger in the registry. Caution: editing the registry incorrectly can cause system instability.
Steps
-
Identify the Uninstall Key – Most programs store their uninstall information under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\UninstallFor 32‑bit apps on 64‑bit Windows, also check:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall -
List Subkeys – Run:
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"Note the subkey name that matches the program’s display name.
-
Delete the Key – Use
reg deletewith the full path:reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" /f Replace
<KeyName>with the exact subkey. -
Confirm Deletion – The program should now be invisible to the “Add or Remove Programs” control panel.
Warning
Only proceed with this method if you are certain the program is completely removed; otherwise, create a system restore point first (SystemPropertiesProtection).
Method 4: Using DISM for Windows Store Apps
Universal Windows Platform (UWP) apps are packaged differently. The Deployment Image Servicing and Management (DISM) tool can remove them.
Steps
-
Open CMD as Administrator.
-
List All App Packages – Run:
dism /online /get-packages -
Identify the Package Identity – Look for the package that matches your app name; note the
PackageName. -
Uninstall the Package – Execute:
dism /online /remove-package /packagename:
Method 5 – PowerShell One‑Liners for Stubborn Entries
When the built‑in UI or wmic queries return nothing, PowerShell can interrogate the registry and the WMI namespaces directly. Open an elevated PowerShell console and run:
# List all uninstall entries that contain the program name
Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object { $_.DisplayName -like '*ProgramName*' } |
Select-Object DisplayName, UninstallString
If the output shows a missing or malformed UninstallString, you can force‑remove the key:
$key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Remove-Item -Path $key -Recurse -Force
For Windows Store apps, the Get-Package cmdlet (available in Windows 10 1809 and later) lists every installed package:
Get-Package | Where-Object { $_.Name -like '*ProgramName*' }
To uninstall a specific package, use its PackageIdentity:
$pkg = Get-Package | Where-Object { $_.Name -like '*ProgramName*' }
Remove-Package -Package $pkg.PackageIdentity
These PowerShell approaches let you script the entire removal process, which is handy for enterprise roll‑outs or repeated clean‑ups.
Method 6 – Third‑Party Uninstallers
When native tools cannot locate the product, dedicated uninstaller utilities often succeed where Windows falls short. Programs such as Revo Uninstaller, IObit Uninstaller, or Geek Uninstaller perform deep scans of:
- the registry,
- file system locations,
- COM registration entries,
- and even scheduled tasks.
Typical workflow:
- Install the utility (most offer a portable version that requires no installation).
- Locate the target program in the list; most tools display a “forced removal” option that also wipes leftover files.
- Initiate the scan, review the results, and confirm deletion.
Because these tools run with elevated privileges, they can access hidden keys that the standard reg delete command might miss And it works..
Method 7 – Vendor‑Provided Silent Uninstallers
Some software vendors ship a command‑line executable (e.g.That said, , uninstall. exe /silent) that removes the product without touching the MSI. Check the application’s installation folder or the vendor’s support site for a “uninstall” utility.
uninstall.exe /quiet /norestart
Running the vendor’s tool guarantees that all components are removed in the order the author intended, eliminating the guesswork involved in manual registry edits.
Method 8 – Manual File‑System Cleanup
Even after the registry entry disappears, residual folders may remain. Common locations include:
%ProgramFiles%\ProgramName%ProgramFiles(x86)%\ProgramName%AppData%\Roaming\ProgramName%LocalAppData%\ProgramName
After confirming that the program is no longer registered, delete these directories (use takeown/icacls to gain permission if needed). A quick PowerShell loop can automate the process:
$paths = @("$env:ProgramFiles\ProgramName", "$env:ProgramFiles(x86)\ProgramName", "$env:AppData\Roaming\ProgramName", "$env:LocalAppData\ProgramName")
foreach ($p in $paths) {
if (Test-Path $p) {
Remove-Item -Path $p -Recurse -Force
}
}
Method 9 – Resetting Windows Optional Features
A few applications are registered as optional Windows features (e.g., “Microsoft Cortana” or “Windows Subsystem Linux”).
dism /online /disable-feature /featurename:
`FeatureName /norestart`
To discover the exact identifier, list all installed optional features first:
```cmd
dism /online /get-features | findstr /i "keyword"
Replace FeatureName with the identity string returned (for example, Microsoft-Windows-Subsystem-Linux). Some features require a system restart to finish removal, so schedule the reboot accordingly. If DISM reports that the feature is not found, verify spelling against the full list or check whether the component belongs to a parent package that must be disabled first.
Method 10 – Safe Mode Removal
If a program locks its own files, runs as a protected service, or reinstalls itself after deletion, boot into Safe Mode. With only essential drivers loaded, most third‑party services and startup items are inactive, making it easier to delete stubborn folders, remove services via sc delete, or run uninstallers without interference. After cleanup, restart normally and verify that the program does not reappear.
Conclusion
Removing stubborn software often requires moving from simple to more forceful techniques. Begin with Settings or Control Panel, then escalate to PowerShell, vendor‑provided uninstallers, or dedicated third‑party tools when native methods leave traces behind. Consider this: always create a system restore point before editing the registry or deleting system files, and double‑check each path to avoid removing shared components. By combining registry cleanup, file‑system sweeps, optional‑feature management, and—if necessary—Safe Mode intervention, you can ensure a clean system free of leftover entries and orphaned files.