In the world of Windows operating systems, managing and uninstalling applications is a common task. While most users resort to the Settings or Control Panel to remove programs, sometimes these standard methods can fail, or you may need to uninstall multiple applications at once. For IT administrators, especially those who need to perform remote operations or manage multiple systems, command line tools can be a powerful solution to streamline the process.
1. Why Use the Command Line to Uninstall Applications?
The command line offers a higher degree of control, allowing users to uninstall programs faster and more efficiently. Unlike graphical interfaces, command line operations are perfect for bulk tasks or remote management. For example, IT administrators often need to uninstall the same program on multiple machines, and using command line scripts can save them significant time and reduce errors in the process.
2. Uninstalling Programs with Command Prompt.
2.1 Opening Command Prompt.
First, press the Windows search box and type `CMD` into the search bar. Right-click on “Command Prompt” from the search results and select “Run as administrator“. This grants elevated privileges necessary to run the uninstallation commands.
2.2 Listing Installed Programs.
Once Command Prompt is open, type the following command to list all programs installed via Windows Installer:
wmic product get name
This command will display a list of all installed applications, allowing you to check if the program you want to uninstall is listed.
2.3 Uninstalling a Specific Program.
To uninstall a specific program, such as 7-Zip, you can run the following command:
wmic product where name="7-Zip 24.08 (x64 edition)" call uninstall
This command will find 7-Zip and initiate the uninstallation process. After the command finishes, you can run the `wmic product get name` command again to verify that the program has been removed.
Note that the name value is the name which is listed in the result of the first command wmic product get name.
2.4 Uninstalling Non-Windows Installer Programs.
If the program was not installed via Windows Installer (for example, using an `.exe` file), you may need to query the registry to remove it. You can do this with the following command: reg query “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”.
C:\Windows\system32>reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AddressBook HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Connection Manager HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DirectDrawEx HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DXM_Runtime HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Fontcore
This command returns details about the software installed in the Windows registry. Perform the following operations according to the preceding path.
Run the following command to get the registry key values associated with 7-Zip.
C:\Windows\system32>reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip DisplayName REG_SZ 7-Zip 24.08 (x64) DisplayVersion REG_SZ 24.08 DisplayIcon REG_SZ C:\Program Files\7-Zip-exe\7zFM.exe InstallLocation REG_SZ C:\Program Files\7-Zip-exe\ UninstallString REG_SZ "C:\Program Files\7-Zip-exe\Uninstall.exe" QuietUninstallString REG_SZ "C:\Program Files\7-Zip-exe\Uninstall.exe" /S NoModify REG_DWORD 0x1 NoRepair REG_DWORD 0x1 EstimatedSize REG_DWORD 0x1642 VersionMajor REG_DWORD 0x18 VersionMinor REG_DWORD 0x8 Publisher REG_SZ Igor Pavlov
To uninstall 7-Zip, run the following command to invoke the non-graphical uninstaller that comes with 7-Zip.
C:\Windows\system32>call "C:\Program Files\7-Zip-exe\Uninstall.exe" /S
3. Benefits of Command Line Uninstallation.
- Batch Uninstallation: Command line scripts can uninstall multiple programs at once, making it ideal for large-scale operations in IT environments.
- Remote Management: With command line tools, administrators can remotely uninstall programs on other machines, making it a great solution for networked environments.
- Efficient System Maintenance: Sometimes, programs cannot be uninstalled through normal means due to system errors. Command line operations can bypass these issues, ensuring a complete removal of programs.
By mastering the command line uninstallation process, you can significantly improve your system management efficiency. Not only does it resolve the typical uninstall problems, but it also boosts productivity when batch processing or remote management is required.
4. Demo Video.
You can watch the following demo video by auto translate the subtitle to your preferred subtitle language.