12

i want to convert a msi file in to an exe file. When i run msi file with qn option with msiexec then my software install silently. But now i want to convert that msi file into .exe file , and that exe file runs msi file with msiexec /i "path of msi file" /qn option, any idea how to do it.

Anoop Mishra
  • 1,005
  • 2
  • 10
  • 33

3 Answers3

9

We can use 7zip SFX to create switch-less installers. here is a quick walk through

Requirements

  • 7Zip: you can download latest version of 7zip from Official Site.

  • 7Zip SFX Module: Official download page is here.

  • Resource Hacker or any other resource editor (Optional): if you want to use a custom icon for you final executable you should use a resource editor app and replace the icon with your desired one. here is Resource Hacker app download link from it's developer website.

Step1:

Create a exec.bat file in the same folder of your msi file and copy your msiexec /i "path of msi file" /qn in it. I used Installer.msi for my sample so here is my file:

@Echo off
msiexec /i installer.msi /qn

Step2:

Compress msi and bat files to a 7z archive.(you can download and install 7zip from here) in the sample I compressed my Installer.msi and exec.bat to a installer.7z archive.

enter image description here

Step3:

Download and extract 7zSD (from 7zSfx link) and put the file in the same folder of archive, here is direct link to it.

Step4 (Optional):

We can change icon of the installer, to do this we should replace icon of 7zsd.sfx file, in Resource hacker we should open 7zsd.sfx and get to IconGroup > 101 > 1049 and replace the icon with a desired one. then save the new sfx file in the same folder of generated 7z Archive. I saved mine as 7zsdInstaller.sfx.

enter image description here

Step5:

We should create a config file to tell the Sfx file what to do after extracting the archive, here is the config file for the sample:

;!@Install@!UTF-8!
GUIFlags="8+32"
ExtractDialogText="My Sample Installer"
RunProgram="exec.bat"
;!@InstallEnd@!

We should save it in the same folder of our 7z Archive, I named mine config.txt.

Step6:

Now we should combine our file to a single executable, to do this, first we should navigate our Command prompt to a folder we hold our generated files and then we should execute following command:

copy /b 7zsdInstaller.sfx + config.txt + Installer.7z "installer.exe"

Now we should have a installer.exe in the same folder

enter image description here

user3473830
  • 7,165
  • 5
  • 36
  • 52
  • 1
    @AnoopMishra, I updated the answer, you should download and install 7zip from provided link and then select both files, and compress using 7zip archiver – user3473830 Jan 02 '15 at 10:57
  • @KostiaMololkin `%errorlevel%` should do the trick, for example `echo %errorlevel%` prints exit code of last command executed in batch file – user3473830 May 21 '15 at 14:06
  • but where i shoud place %errorlevel% my self extracted exe return success(0) or 9009 when i place in exec.bat @Echo off msiexec /i installer.msi /qn exit %errorlevel% – Kostia Mololkin May 22 '15 at 08:48
  • @KostiaMololkin it's a pseudo environment variable, you should first execute your command then check `%errorlevel%` information about the execution, so logically it should come in the following separate line after your command. – user3473830 May 22 '15 at 14:53
1

If you are making the setup yourself using Installshield, the tool itself should be able to create a setup.exe file by simply setting the release settings in the release wizard - I think it just entails setting the release "Compressed" but it could require further settings.

Please follow these help file instructions precisely. It is possible that some versions of Installshield (express, older versions etc...) does not have this option, but frankly I doubt it. It should be there once you look.

Perhaps also see this youtube.com demonstration of the release wizard and this previous stackoverflow question: HowTo create InstallShield MSI with no files needed locally?

Community
  • 1
  • 1
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
0

You are supposed to use install shield product of flexa software. You can compress your msi into .exe with all supported files used for extraction at the time of installation.

RaviKant Hudda
  • 1,042
  • 10
  • 25