System hacks: add two useful right-click menu items for MSI files

MSI is the Microsoft Windows Install packet file format, in which many programs’ installation files are provided. If we need to use some useful files contained in the MSI file (e.g. images, icon files, description files, etc.), can we extract the required files without performing the installation process for that file? In addition, if an MSI program needs to be installed as an administrator to get access to the advanced features of the software, how can we choose to run it as an administrator, just like using the right-click menu command of an EXE program? In fact, there are only two useful right-click menu items that can be added to the MSI file.

1. Add the “Extract” option for MSI files

As we know, Windows handles MSI packages through the msiexec application, which is part of the Windows installer and is a built-in tool that supports many command-line switches. We can use this command and its associated file extraction switches to add the option of right-click file extraction for MSI files.

Trivia: About the msiexec command

First, we can learn about the msiexec application by running the “msiexec /?” command to learn how to use the msiexec application and its options. After executing this command in the “Run” dialog, the help window for the msiexec command will open (Figure 1).

2014A-MSI-1

The option related to what we need is /a. Although it is described by the program’s help system as “Manage installation – install products on the network”, it can be used to extract the contents of a single MSI package. The specific command format used is as follows.

msiexec /a “pathtopackage.msi” /qb TARGETDIR=”pathtothedestinationfolder”

In the above command, TARGETDIR= is a public attribute keyword for each MSI package to specify the destination folder of the MSI package contents. The switch “/qb” tells the Windows installer to display a basic interface during execution, which will display a dialog box with a “Cancel” button and a progress bar.

Based on the above program command, we can add this command as an Extract option to the right-click menu of the MSI file via the Registry Editor. This is done as follows.

First, start the Registry Editor and locate “HKEY_CLASSES_ROOTMsi.Packageshell” in order; then, create a new sub-section named “Extract” under the shell. Then, create a new sub-item named “Extract” under shell and change its “(default)” value to “Extract” (Figure 2).

2014A-MSI-2

Next, create a new sub-section named Command under Extract. And set its “(default)” value to the following command string (Figure 3).

msiexec.exe /a “%1″ /qb TARGETDIR=”%1 Contents”

2014A-MSI-3

After that, close the registry editor. Right-click on an MSI package in the File Explorer and you will find the “Extract” item in the context menu (Figure 4). After selecting it, a new directory “PackageName.msi Contents” will be created in the current folder, where the contents of the extracted MSI package are stored (Figure 5).

2014A-MSI-4

Tip.

If you think the above registry operation steps are troublesome, or beginners are worried about the security of operating the registry, you can also use the registry file we prepared for you (there are two files in the zip package, download link: https://pan.baidu.com/s/1jQGIBBSZ_zd6VvsPpb_Ygg Extract Code: gjhk), download and execute After downloading the file “Add Extract Command to MSI Context Menu.reg” and importing it into the registry, you can automatically generate the MSI right-click menu Extract option for extracted files. If you need to cancel the MSI Context Menu Extract option, just execute the “Remove Extract Command to MSI Context Menu.reg” registry file. 2.

2014A-MSI-5

Add the “Run as administrator” option

If you need to add a right-click option to MSI to run as administrator, you can first locate the same branch as above in the Registry Editor, then right-click on the shell, select “New → Item” and rename the new item to “runas”. . Select the runas item, then double-click the “Default” string value in the right window, and in the “Edit String” window that pops up, change the value data to “Run as administrator “, OK (Figure 6).

2014A-MSI-6

Next, create a new “command” item under “runas”, and change the value of its “default” string value to “msiexec /i “%1″” (Figure 7). Finally, close the registry editor.

2014A-MSI-7

Then, right-click on the MSI installation package and you will see the “Run as administrator” option in the context menu (Figure 8).

2014A-MSI-8

Tip.

The above tips apply to Windows 10, Windows 8 and Windows 7.

Leave a Comment