Last active
April 12, 2026 14:16
-
-
Save eladkarako/3f30f5958ecf289cebd6dcfcbfcad44c to your computer and use it in GitHub Desktop.
msi_extractor.cmd - extracting msi package, into a folder of its files and the installation script, the result is 100% installable and since it is unpacked it is super fast too, you can view all the files, and you can repack them with 7zip or something. includes MSI exit codes, and log. eladkarako 202604121627.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| :: you can also add a nice context-menu entry for right-clicking .msi files. | |
| ::--------------------------------------------------------------------------- | |
| ::Windows Registry Editor Version 5.00 | |
| :: | |
| ::[HKEY_CLASSES_ROOT\Msi.Package\shell\msi_extractor] | |
| ::"Icon"="%SystemRoot%\\System32\\msiexec.exe,0" | |
| ::@="MSI Extractor" | |
| :: | |
| ::[HKEY_CLASSES_ROOT\Msi.Package\shell\msi_extractor\command] | |
| ::@="\"C:\\path\\to\\msi_extractor.cmd\" \"%1\"" | |
| ::--------------------------------------------------------------------------- | |
| :: | |
| :: make sure to change `C:\\path\\to\\` to where you've placed this file.. | |
| :: don't forget to use \\ (not just one \). | |
| :: | |
| :: notes: msiexec is under `C:\Windows\System32\msiexec.exe` | |
| :: which is in the system PATH so no explicit path is needed. | |
| :: `C:\Windows\System32\msiexec.exe,0` is the first icon embedded in the file. | |
| :: | |
| ::-------------------------------------------------------------------------------------------- | |
| :: msi_extractor.cmd - extracting msi package, into a folder of its files and the installation script, the result is 100% installable and since it is unpacked it is super fast too, you can view all the files, and you can repack them with 7zip or something. includes MSI exit codes, and log. eladkarako 202604121627. | |
| :: https://gist.github.com/eladkarako/3f30f5958ecf289cebd6dcfcbfcad44c#file-msi_extractor-cmd | |
| ::-------------------------------------------------------------------------------------------- | |
| chcp 65001 1>nul 2>nul | |
| ::-------------- very important to set the folder to the same folder as the input file, the working-directory of anything from explorer.exe is auto set to C:\Windows\System32 so this line is a MUST! | |
| pushd "%~sdp1" | |
| set "ARGS=" | |
| ::----------------------------------- Administrative install - note: do not use %~sf1 otherwise the result "msi folder" will also have short name, which is not very readable. - Installs a product on the network /a <Product.msi> | |
| set ARGS=%ARGS% /a "%~f1" | |
| ::----------------------------------- Sets user interface level /q[n|b|r|f] n - No UI b - Basic UI r - Reduced UI f - Full UI (default) | |
| set ARGS=%ARGS% /qb | |
| ::----------------------------------- Logging Options note: do not wrap with "" /l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile> i - Status messages w - Nonfatal warnings e - All error messages a - Start-up of actions r - Action-specific records u - User requests c - Initial UI parameters m - Out-of-memory or fatal exit information o - Out-of-disk-space messages p - Terminal properties v - Verbose output x - Extra debugging information + - Append to existing log file ! - Flush each line to the log * - Log all information, except for v and x options | |
| ::set ARGS=%ARGS% /lvx* "%TEMP%\msi_extractor_log_%~nx1.log" | |
| ::----------------------------------- Setting Public Properties [PROPERTY=PropertyValue] - note: to save some characters first-part of the path (%~sdp1) is short since it doesn't matter, the new-folder name (auto-created) for the target (identical to msi name - %~n1) is normal though | |
| set ARGS=%ARGS% TARGETDIR="%~sdp1%~n1\" | |
| ::----------------------------------- (same as above) newer versions might use INSTALLDIR. | |
| set ARGS=%ARGS% INSTALLDIR="%~sdp1%~n1\" | |
| echo "msiexec.exe" %ARGS% 1>&2 | |
| echo. 1>&2 | |
| call "msiexec.exe" %ARGS% | |
| set "EXIT_CODE=%ErrorLevel%" | |
| echo [INFO] EXIT_CODE: %EXIT_CODE% 1>&2 | |
| goto EXITCODE_%EXIT_CODE% | |
| ::-------------------------- fallback if label for that exit code does not exists.. | |
| goto EXITCODE_UNKNOWN | |
| ::--------------------------------------------------------------- | |
| :EXITCODE_UNKNOWN | |
| echo [INFO] %EXIT_CODE% is an unknown exit-code.. 1>&2 | |
| goto END | |
| :EXITCODE_0 | |
| echo [0 ERROR_SUCCESS] The action completed successfully. 1>&2 | |
| goto END | |
| :EXITCODE_13 | |
| echo [13 ERROR_INVALID_DATA] The data is invalid. 1>&2 | |
| goto END | |
| :EXITCODE_87 | |
| echo [87 ERROR_INVALID_PARAMETER] One of the parameters was invalid. 1>&2 | |
| goto END | |
| :EXITCODE_120 | |
| echo [120 ERROR_CALL_NOT_IMPLEMENTED] This value is returned when a custom action attempts to call a function that cannot be called from custom actions. The function returns the value ERROR_CALL_NOT_IMPLEMENTED. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1259 | |
| echo [1259 ERROR_APPHELP_BLOCK] If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog box informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation. 1>&2 | |
| goto END | |
| :EXITCODE_1601 | |
| echo [1601 ERROR_INSTALL_SERVICE_FAILURE] The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered. 1>&2 | |
| goto END | |
| :EXITCODE_1602 | |
| echo [1602 ERROR_INSTALL_USEREXIT] The user cancels installation. 1>&2 | |
| goto END | |
| :EXITCODE_1603 | |
| echo [1603 ERROR_INSTALL_FAILURE] A fatal error occurred during installation. 1>&2 | |
| goto END | |
| :EXITCODE_1604 | |
| echo [1604 ERROR_INSTALL_SUSPEND] Installation suspended, incomplete. 1>&2 | |
| goto END | |
| :EXITCODE_1605 | |
| echo [1605 ERROR_UNKNOWN_PRODUCT] This action is only valid for products that are currently installed. 1>&2 | |
| goto END | |
| :EXITCODE_1606 | |
| echo [1606 ERROR_UNKNOWN_FEATURE] The feature identifier is not registered. 1>&2 | |
| goto END | |
| :EXITCODE_1607 | |
| echo [1607 ERROR_UNKNOWN_COMPONENT] The component identifier is not registered. 1>&2 | |
| goto END | |
| :EXITCODE_1608 | |
| echo [1608 ERROR_UNKNOWN_PROPERTY] This is an unknown property. 1>&2 | |
| goto END | |
| :EXITCODE_1609 | |
| echo [1609 ERROR_INVALID_HANDLE_STATE] The handle is in an invalid state. 1>&2 | |
| goto END | |
| :EXITCODE_1610 | |
| echo [1610 ERROR_BAD_CONFIGURATION] The configuration data for this product is corrupt. Contact your support personnel. 1>&2 | |
| goto END | |
| :EXITCODE_1611 | |
| echo [1611 ERROR_INDEX_ABSENT] The component qualifier not present. 1>&2 | |
| goto END | |
| :EXITCODE_1612 | |
| echo [1612 ERROR_INSTALL_SOURCE_ABSENT] The installation source for this product is not available. Verify that the source exists and that you can access it. 1>&2 | |
| goto END | |
| :EXITCODE_1613 | |
| echo [1613 ERROR_INSTALL_PACKAGE_VERSION] This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. 1>&2 | |
| goto END | |
| :EXITCODE_1614 | |
| echo [1614 ERROR_PRODUCT_UNINSTALLED] The product is uninstalled. 1>&2 | |
| goto END | |
| :EXITCODE_1615 | |
| echo [1615 ERROR_BAD_QUERY_SYNTAX] The SQL query syntax is invalid or unsupported. 1>&2 | |
| goto END | |
| :EXITCODE_1616 | |
| echo [1616 ERROR_INVALID_FIELD] The record field does not exist. 1>&2 | |
| goto END | |
| :EXITCODE_1618 | |
| echo [1618 ERROR_INSTALL_ALREADY_RUNNING] Another installation is already in progress. Complete that installation before proceeding with this install.For information about the mutex, see _MSIExecute Mutex. 1>&2 | |
| goto END | |
| :EXITCODE_1619 | |
| echo [1619 ERROR_INSTALL_PACKAGE_OPEN_FAILED] This installation package could not be opened. Verify that the package exists and is accessible, or contact the application vendor to verify that this is a valid Windows Installer package. 1>&2 | |
| goto END | |
| :EXITCODE_1620 | |
| echo [1620 ERROR_INSTALL_PACKAGE_INVALID] This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. 1>&2 | |
| goto END | |
| :EXITCODE_1621 | |
| echo [1621 ERROR_INSTALL_UI_FAILURE] There was an error starting the Windows Installer service user interface. Contact your support personnel. 1>&2 | |
| goto END | |
| :EXITCODE_1622 | |
| echo [1622 ERROR_INSTALL_LOG_FAILURE] There was an error opening installation log file. Verify that the specified log file location exists and is writable. 1>&2 | |
| goto END | |
| :EXITCODE_1623 | |
| echo [1623 ERROR_INSTALL_LANGUAGE_UNSUPPORTED] This language of this installation package is not supported by your system. 1>&2 | |
| goto END | |
| :EXITCODE_1624 | |
| echo [1624 ERROR_INSTALL_TRANSFORM_FAILURE] There was an error applying transforms. Verify that the specified transform paths are valid. 1>&2 | |
| goto END | |
| :EXITCODE_1625 | |
| echo [1625 ERROR_INSTALL_PACKAGE_REJECTED] This installation is forbidden by system policy. Contact your system administrator. 1>&2 | |
| goto END | |
| :EXITCODE_1626 | |
| echo [1626 ERROR_FUNCTION_NOT_CALLED] The function could not be executed. 1>&2 | |
| goto END | |
| :EXITCODE_1627 | |
| echo [1627 ERROR_FUNCTION_FAILED] The function failed during execution. 1>&2 | |
| goto END | |
| :EXITCODE_1628 | |
| echo [1628 ERROR_INVALID_TABLE] An invalid or unknown table was specified. 1>&2 | |
| goto END | |
| :EXITCODE_1629 | |
| echo [1629 ERROR_DATATYPE_MISMATCH] The data supplied is the wrong type. 1>&2 | |
| goto END | |
| :EXITCODE_1630 | |
| echo [1630 ERROR_UNSUPPORTED_TYPE] Data of this type is not supported. 1>&2 | |
| goto END | |
| :EXITCODE_1631 | |
| echo [1631 ERROR_CREATE_FAILED] The Windows Installer service failed to start. Contact your support personnel. 1>&2 | |
| goto END | |
| :EXITCODE_1632 | |
| echo [1632 ERROR_INSTALL_TEMP_UNWRITABLE] The Temp folder is either full or inaccessible. Verify that the Temp folder exists and that you can write to it. 1>&2 | |
| goto END | |
| :EXITCODE_1633 | |
| echo [1633 ERROR_INSTALL_PLATFORM_UNSUPPORTED] This installation package is not supported on this platform. Contact your application vendor. 1>&2 | |
| goto END | |
| :EXITCODE_1634 | |
| echo [1634 ERROR_INSTALL_NOTUSED] Component is not used on this machine. 1>&2 | |
| goto END | |
| :EXITCODE_1635 | |
| echo [1635 ERROR_PATCH_PACKAGE_OPEN_FAILED] This patch package could not be opened. Verify that the patch package exists and is accessible, or contact the application vendor to verify that this is a valid Windows Installer patch package. 1>&2 | |
| goto END | |
| :EXITCODE_1636 | |
| echo [1636 ERROR_PATCH_PACKAGE_INVALID] This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package. 1>&2 | |
| goto END | |
| :EXITCODE_1637 | |
| echo [1637 ERROR_PATCH_PACKAGE_UNSUPPORTED] This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. 1>&2 | |
| goto END | |
| :EXITCODE_1638 | |
| echo [1638 ERROR_PRODUCT_VERSION] Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs in Control Panel. 1>&2 | |
| goto END | |
| :EXITCODE_1639 | |
| echo [1639 ERROR_INVALID_COMMAND_LINE] Invalid command line argument. Consult the Windows Installer SDK for detailed command-line help. 1>&2 | |
| goto END | |
| :EXITCODE_1640 | |
| echo [1640 ERROR_INSTALL_REMOTE_DISALLOWED] The current user is not permitted to perform installations from a client session of a server running the Terminal Server role service. 1>&2 | |
| goto END | |
| :EXITCODE_1641 | |
| echo [1641 ERROR_SUCCESS_REBOOT_INITIATED] The installer has initiated a restart. This message is indicative of a success. 1>&2 | |
| goto END | |
| :EXITCODE_1642 | |
| echo [1642 ERROR_PATCH_TARGET_NOT_FOUND] The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. 1>&2 | |
| goto END | |
| :EXITCODE_1643 | |
| echo [1643 ERROR_PATCH_PACKAGE_REJECTED] The patch package is not permitted by system policy. 1>&2 | |
| goto END | |
| :EXITCODE_1644 | |
| echo [1644 ERROR_INSTALL_TRANSFORM_REJECTED] One or more customizations are not permitted by system policy. 1>&2 | |
| goto END | |
| :EXITCODE_1645 | |
| echo [1645 ERROR_INSTALL_REMOTE_PROHIBITED] Windows Installer does not permit installation from a Remote Desktop Connection. 1>&2 | |
| goto END | |
| :EXITCODE_1646 | |
| echo [1646 ERROR_PATCH_REMOVAL_UNSUPPORTED] The patch package is not a removable patch package. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1647 | |
| echo [1647 ERROR_UNKNOWN_PATCH] The patch is not applied to this product. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1648 | |
| echo [1648 ERROR_PATCH_NO_SEQUENCE] No valid sequence could be found for the set of patches. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1649 | |
| echo [1649 ERROR_PATCH_REMOVAL_DISALLOWED] Patch removal was disallowed by policy. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1650 | |
| echo [1650 ERROR_INVALID_PATCH_XML] The XML patch data is invalid. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1651 | |
| echo [1651 ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT] Administrative user failed to apply patch for a per-user managed or a per-machine application that is in advertise state. Available beginning with Windows Installer version 3.0. 1>&2 | |
| goto END | |
| :EXITCODE_1652 | |
| echo [1652 ERROR_INSTALL_SERVICE_SAFEBOOT] Windows Installer is not accessible when the computer is in Safe Mode. Exit Safe Mode and try again or try using System Restore to return your computer to a previous state. Available beginning with Windows Installer version 4.0. 1>&2 | |
| goto END | |
| :EXITCODE_1653 | |
| echo [1653 ERROR_ROLLBACK_DISABLED] Could not perform a multiple-package transaction because rollback has been disabled. Multiple-Package Installations cannot run if rollback is disabled. Available beginning with Windows Installer version 4.5. 1>&2 | |
| goto END | |
| :EXITCODE_1654 | |
| echo [1654 ERROR_INSTALL_REJECTED] The app that you are trying to run is not supported on this version of Windows. A Windows Installer package, patch, or transform that has not been signed by Microsoft cannot be installed on an ARM computer. 1>&2 | |
| goto END | |
| :EXITCODE_3010 | |
| echo [3010 ERROR_SUCCESS_REBOOT_REQUIRED] A restart is required to complete the install. This message is indicative of a success. This does not include installs where the ForceReboot action is run. 1>&2 | |
| goto END | |
| :END | |
| pause | |
| popd | |
| exit /b %EXIT_CODE% | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I include, in this comment a few helpful stuff.
first, choose a folder for where you want to download the cmd file above,
I have named it
msi_extractor.cmdand placed it inD:\DOS\msi_extractor\msi_extractor.cmdcopy this to
generate_reg.cmdand run it, it will generate a file namedmsi_extractor - install.regbased on your folder of choice. you don't have to add a context menu for each
.msifile, you can just add the shortcut tomsi_extractor.cmdinto your sendto menu.note that it will not add anything to the registry for you, and perfectly safe to run!
it created this file for me:
msi_extractor - install.regwith this content:now to install the context menu item for right click on all msi file,
you need to double click it, and admin notification should popup for you.
you can also run
regedit.exeas admin, and choose file-import and selectmsi_extractor - install.regremoving the menu entry needs no special manner, just copy this to
msi_extractor - uninstall.regand either double click the file or use regedit as admin and file-import.
note regarding newer installers
there is a newer format that is called wix,
often comes with an exe extension,
you can still unpack it you just need to download wix toolset v3,
https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip
it uses an execute named
dark.exe,when you drop the installation file over the batch file,
it will unpack the first layer, often some UI components, and a folder with actual msi,
make adjustments to the paths above I'm placing the program under
D:\DOS\wix_toolset\wix314-binaries\dark.exeand the batch file under
D:\DOS\wix_toolset\_extract_wix_msi_installations.cmdbut you don't have to.after you unpack the first layer you can use the
msi_extractor.cmdto unpack the msi package normally.