Table of Contents
How to Uninstall Software via Command Line (Windows)
Uninstalling software via the Command Prompt (CMD) or PowerShell is an efficient way to manage applications, especially when the “Apps & Features” GUI is unresponsive or when you need to automate the process via scripting.
Prerequisites
- Administrator Privileges: You must run CMD or PowerShell as an Administrator.
- Process Termination: Ensure the application and its background processes are closed.
- Installation Type: Determine if the app was installed via an MSI/EXE installer or if it is a “Portable” version.
Method 1: Using WMIC (Standard)
The Windows Management Instrumentation Command-line (WMIC) is the most common method for identifying and removing software by name.
1. Identify the Software Name
To see the exact name of the software as registered in the system, run:
wmic product get name
2. Execute Uninstall
Use the following syntax (using MobaXterm as an example):
wmic product where "name like 'MobaXterm%%'" call uninstall
Note: The %% acts as a wildcard. Confirm the action by pressing Y when prompted.
Method 2: Using MSIExec (For MSI Packages)
If the software was installed using a Windows Installer (.msi) package, it is best removed using its unique Product GUID.
1. Find the Product GUID
List all installed products and their identifying numbers:
wmic product get name, identifyingnumber
2. Execute Uninstall
Once you have the GUID (e.g., {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}), run:
msiexec /x {YOUR-GUID-HERE} /qn
- /x: Uninstall command.
- /qn: “Quiet” mode (no UI interaction).
Method 3: Using PowerShell (Modern Approach)
PowerShell is more robust for Windows 10 and 11. It can often find packages that WMIC misses.
powershell -command "Get-Package -Name 'SoftwareName*' | Uninstall-Package"
Example for MobaXterm:
powershell -command "Get-Package -Name 'MobaXterm*' | Uninstall-Package"
Method 4: Using Winget (Windows Package Manager)
If you have Winget installed (standard on modern Windows 10/11), this is the cleanest method.
1. Search for the App
winget list "Software Name"
2. Uninstall
winget uninstall "MobaXterm"
Method 5: Portable Applications
Portable software (like MobaXterm Portable) does not appear in the system's “Installed Programs” list because it doesn't write to the registry.
To “uninstall” these:
- Close the application.
- Manually delete the folder containing the executable (e.g.,
C:\Tools\MobaXterm\). - Clean up user-specific data in
%AppData%or%LocalAppData%if necessary.
Troubleshooting
| Issue | Solution |
|---|---|
| Error: 1605 | This action is only valid for products that are currently installed. Check if the GUID is correct. |
| Access Denied | Right-click CMD/PowerShell and select “Run as Administrator”. |
| App still running | Use taskkill /f /im processname.exe to force close the app before uninstalling. |
References:
