How to use the command 'msiexec' (with examples)
- Windows
- December 25, 2023
The ‘msiexec’ command is used in Windows operating systems to install, update, repair, or uninstall Windows programs using MSI (Windows Installer) and MSP (Windows Installer Patch) package files.
Use case 1: Install a program from its MSI package
Code:
msiexec /package path\to\file.msi
Motivation: This use case is useful when you want to install a program on your Windows machine using an MSI package file. Many software applications, especially those developed by Microsoft, are often distributed as MSI packages.
Explanation: The ‘/package’ parameter specifies the path to the MSI package file that you want to install.
Example output: The program specified in the MSI package file will be installed on the system.
Use case 2: Install a MSI package from a website
Code:
msiexec /package https://example.com/installer.msi
Motivation: This use case allows you to directly install an MSI package from a website. This is convenient when you don’t have the MSI package file saved locally and want to download and install it directly from a web source.
Explanation: The ‘/package’ parameter specifies the URL of the MSI package file that you want to install.
Example output: The program specified in the MSI package file will be downloaded from the website and installed on the system.
Use case 3: Install a MSP patch file
Code:
msiexec /update path\to\file.msp
Motivation: This use case is used to install an MSP patch file, which is used to update or modify an existing installation of a program. MSP files are commonly provided by software vendors to fix bugs, add features, or apply security updates to their applications.
Explanation: The ‘/update’ parameter specifies the path to the MSP patch file that you want to install.
Example output: The MSP patch file will be applied to the existing installation, updating or modifying the program accordingly.
Use case 4: Uninstall a program or patch using their respective MSI or MSP file
Code:
msiexec /uninstall path\to\file
Motivation: This use case allows you to uninstall a program or patch from your Windows machine using the respective MSI or MSP file. It is useful when you want to completely remove a program or revert back to a previous version by uninstalling the patch.
Explanation: The ‘/uninstall’ parameter specifies the path to the MSI or MSP file of the program or patch that you want to uninstall.
Example output: The program or patch specified in the MSI or MSP file will be uninstalled from the system.