Help - Search - Members - Calendar
Full Version: How to make a 7-Zip Switchless Installer
MSFN Forums > Unattended Windows Discussion & Support > Application Installs
Pages: 1, 2, 3, 4, 5, 6

   


Google Internet Forums Unattended CD/DVD Guide
keytotime
  1. Download and install the latest version of 7-Zip.
  2. Make a folder to copy all of the installation files to. If you are using a .msi include Msistub.exe in the folder. Make sure the installer name is under 8 character and has no spaces.
  3. Select all of them and right click on any file.
  4. Select "Add to archive...", which is under the select option.
  5. You can make the archive name to whatever you want it to be. Set the compression level to Ultra.

  6. Hit OK. Once the archive is created, you can delete all files except the archive.
  7. Copy 7zs.sfx to the folder containing the archive. This one has no cancel button.
  8. If you want, you can change the icon of the installer by replacing the icon in 7zS.sfx using ResHacker. For example, you can use the icon from the main program. Remember to save 7zS.sfx when you're finished.


    In order to get rid of the cancel button and the close button, go to Dialog→500→1033. Select all then paste in this code:
    CODE
    500 DIALOG 0, 0, 186, 26
    STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
    CAPTION "Progress"
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    FONT 8, "MS Shell Dlg"
    {
       CONTROL "Progress1", 1000, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 7, 7, 172, 14
    }

    In order to get rid of everthing paste in this code.
    CODE
    500 DIALOG 0, 0, 0, 0
    STYLE WS_POPUP
    CAPTION "Progress"
    LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    FONT 8, "MS Shell Dlg"
    {
    }
    Select compiles and then save
  9. Open Notepad and add the following:
    CODE
    ;!@Install@!UTF-8!
    RunProgram="program.exe –switch"
    ;!@InstallEnd@!
    Replace program.exe with the name of your installer (including the extension). Replace -switch with the desired switch(es) to be used. You can also use a .cmd.

    If you are using a .msi package you will need to use Msistub.exe. Msistub.exe will have to be inside the archive. The code for config.txt will be:
    CODE
    ;!@Install@!UTF-8!
    RunProgram="msistub program.msi /qb-!"
    ;!@InstallEnd@!

    Where program.msi is the name of the msi. You can use /qb-! for an install with a progress screen and /qn for a install with no screen.
  10. Save as config.txt with UTF-8 encoding by selecting "UTF-8" from the dropdown menu in the "Save As..." dialog in Notepad. Save it to the same folder as 7zS.sfx and the 7z archive.

  11. The folder should now look something like this:
  12. Open a command prompt. CD to the folder. Then enter the following command:
    CODE
    copy /b 7zs.sfx + config.txt + (whatever the archive name).7z (Installer_Name).exe

That's it, you're done. Try it out.


Thanks Mavericks choice and RyanVM. Added .msi information.
Bâshrat the Sneaky
Very clear guide!

Bâshrat the Sneaky has added a bookmark!
Astalavista
excellent!

why do u need this?

"msiexec /i program.msi /qb-!\""

what is the purpose of the msiexec?

i hv several msi installers and i never use this and it still works.
keytotime
@ Astalavista, a .msi is an install package that calls on msiexec. msiexec /i tells windows to install the .msi. Since 7-zip can not call on msiexec directly we need StartX to call on msiexec for us. Type in msiexec /? at run to see more.
Astalavista
thanks keytotime for explaining that to me.

i use a quick batch file converter to make my "Installer.exe"

remember u told me i dont hv to use it anymore.

My Installer.exe is much smaller than StartX.exe and i can put multiple
commands in it. Just like evilvoice's method.

good job man... great to hv a new guide to help everyone make their own
7zip applications. Hopefully we will be seeing a rise in pre 7zip applications in the future.
keytotime
I used startx becuase it is free and i know that o some machines batch files converted using quick batch file coverter does not work. My machine being one of them whistling.gif . Also startx compressed with upx is 90Kb while your installer.exe for office is 144. I atached the compressed startx in my original post.
Astalavista
Actually i did not upx my installer.exe

if i did it would only be 80kb

thanks for reminding me. i will update it now
keytotime
bah this is retarded, we're arguing over 10kb. Startx is free and works better than qbf for me. A for the multiple commands. That why we can do

REG ADD %KEY%\020 /VE /D "Symantec Antivirus 9.3" /f
REG ADD %KEY%\020 /V 1 /D "%CDROM%\Apps\sav.exe" /f
REG ADD %KEY%\020 /V 2 /D "REGEDIT /S %CDROM%\Apps\1.reg" /f
Astalavista
I agree if u dont hv quick batch file converter, startX.exe is for you.
Derkan
There is an MSI installer of 7-zip? I was actually looking for one a few days ago but didn't find anything. Not on the official site, not somewhere else. Maybe it's in the new beta, but I can't extract or test that file without getting an error that it's unsupported and the process cancelling.

Can you shed some light on this?
keytotime
This is a tutorial how to make a switchless for any program using 7-Zip. The new 7-zip uses /S.
Derkan
For, not of. Got it. smile.gif Anyway, I've got this thread bookmarked. biggrin.gif
moo
Nice and clear guide!
I think that admin schould bookmark it in point of interests, because similar guide was published on this site long time ago, but was lost.

@Astalavista
And keytotime right about the StartXP - it always works, plus free. Btw, why do you use it if your applications better when repacked switcheless acrobat7?
regards, moo
Astalavista
moo u must be mistaken i dont use it. u can't check my latest Adobe Acrobat build.
moo
@astalavista
boom...
sorry man and thanks for good job too on another posts.
moo
Astalavista
no problem moo moo.
Mekrel
I got a problem, nice guide though smile.gif

the problem is this

Im converting all my WinRAR SFX installers to 7-Zip SFX installer, and im using 7-Zip on some Install Shield installers.

One of them is Anti virus Kit 2004 from GData, and I had it installing fine before with the switches i use in the config.txt which is saved with UTF-8 encoding like stated in the guide.

CODE
;!@Install@!UTF-8!
RunProgram="Setup.exe -s -f2\"%systemdrive%\avk.log\""
;!@InstallEnd@!


The setup.iss is in the archive aswell, and being as its ran from %CDROM% variable, it needs to have the avk.log assigned to it too according to the unattended guide made by Allanol.

Any ideas?
batman75
Excellent Tut.
Thanks for the work
Rico.JohnnY
Is it possible to run multiple commands in config.txt?

For example, applying reg tweak after running setup.exe
Mekrel
QUOTE (Rico.JohnnY @ Feb 14 2005, 07:32 PM)
Is it possible to run multiple commands in config.txt?

For example, applying reg tweak after running setup.exe
*


Well for the problem i posted above, I have sorted it using a .cmd file.

Seems to you cant run a installer which needs. iss from the config.txt.

So to do what you want make a .cmd and include it in the Archive.7z

CODE
setup.exe /switch /anotherswitch
/wait REGEDIT settings.reg


Then call the .cmd file from config.txt
keytotime
Updated the guide to make it clearer.
Astalavista
It keeps getting better and better keytotime.
FrankE9999
QUOTE (Mekrel @ Feb 14 2005, 10:15 AM)
I got a problem, nice guide though smile.gif

the problem is this

Im converting all my WinRAR SFX installers to 7-Zip SFX installer, and im using 7-Zip on some Install Shield installers.

One of them is Anti virus Kit 2004 from GData, and I had it installing fine before with the switches i use in the config.txt which is saved with UTF-8 encoding like stated in the guide.

CODE
;!@Install@!UTF-8!
RunProgram="Setup.exe -s -f2\"%systemdrive%\avk.log\""
;!@InstallEnd@!


The setup.iss is in the archive aswell, and being as its ran from %CDROM% variable, it needs to have the avk.log assigned to it too according to the unattended guide made by Allanol.

Any ideas?
*



Try ising the /SMS switch with the setup. Note this switch should be upper case as shown. RunProgram="Setup.exe -s -SMS -f2\"%systemdrive%\avk.log\""

Install Shield Command Line Parameters
http://zacky.cleverits.com/IT/is_cmdline.htm

MSI Online Commandline Generator ("CleverMSI-OCG")
http://zacky.cleverits.com/IT/MSI/msi_cmdline.htm
Mekrel
Thats for network usage though, anyway i sorted it running it from a batch which aint a biggie.
FrankE9999
With 7Zip the files are extracted to the temp folder, the setup.exe is run and then the files are removed from the temp folder. The SMS option prevents setup.exe from returning before all child process have completed. This way your files aren't deleted until your install finishes.
fluid
Thanks for the tutorial! For clarification, the exe that I'm gonna put in the config is the setup application that's gonna launch the setup right? For example im mp10setup.exe, there is the setup_wm.exe file inside. That's the exe that I'm gonna put in the config.txt right?
scankurban
Why do you need 7zip
Astalavista
you asking why u need 7zip?

ah... makes installers smaller. lol tongue.gif
fluid
Wow thanks a lot again for the guide I just made myself a 7zip wmp 10 exe. Cool. It trimmed down about 3 mb.
Astalavista
why dont u just integrate it?
fluid
Integrate?
Astalavista
u integrate wmp into your U.A. cd.

look for the guide by Bashrat
EdwardQ
I'm having problems getting this to run.

I followed the direction to a T. but when I test it the files look like they are extracted but the msi doesn't install.

Here is my config.txt

;!@Install@!UTF-8!
RunProgram="StartX.exe /WAIT \"msiexec /i Adobe.msi /qb-!\""
;!@InstallEnd@!


If I try via command line StartX.exe /WAIT "msiexec /i Adobe.msi /qb-!" the program installs.


Thxs.


Ed.
Astalavista
what are u trying to do shrink adobe acrobat pro?
EdwardQ
no reader 6.0. <Looks at the sig> I know there is alrdy a installer but 3 reasons I need to do this. 1) I need to learn, 2) I need to know what to do when I try it on the other other non standard software. 3) I need to learn.
Astalavista
KeytoTime is a pioneer in 7zip guides.

If u can't understand i dont know what to tell u it already gives u everything
u need to build a 7zip installer.

My installers are slightly different since i dont use StartX

sad.gif

Prior to using this program i suggest that first learn about adobe acrobat
reader install points. Then follow his guide again step by step.

Cheers
FoLmEr
Hi there...

I'm also experiencing rather strange problems with 7zip and this guide.
I'm trying to pack the IntelliPoint software from Microsoft version 4.12 and I already have it install flawlessly from a RunOnceEx command:

CODE
IP4_1.msi MM=14 /QR REBOOT=ReallySuppress

The reason I want to pack it is that right now all the install files are unpacked in a folder which obviously takes up more space than a compressed package.

Now, I've compressed the installation files (including StartX.exe), changed icons in the 7zs.sfx, written a config.txt, copied all three files to a single .exe - in other words, followed the guide exactly as stated. The problem is that it won't start the .msi which I instruct it to. Instead, it tries to start the setup.exe which is also in the package. It isn't needed but it's there since I figured it didn't matter.
Here's my config.txt (saved in UTF-8 format):

CODE
;!@Install@!UTF-8!
RunProgram="StartX.exe /WAIT \"msiexec /i IP4_1.msi MM=14 /QR REBOOT=ReallySuppress\""
;!@InstallEnd@!

Here comes the strange part: it works like a charm in WinRAR! Here's the comment:
CODE
;The comment below contains SFX script commands

Setup=StartX.exe /WAIT "msiexec /i IP4_1.msi MM=14 /QR REBOOT=ReallySuppress"
TempMode
Silent=1
Overwrite=1

I have been able to make similar working 7zip files using this guide, I just can't see why this one doesn't. Also, I've been making 7zip sfx's from ATi catalyst which don't change icons and can't be deleted blink.gif Thus I have 4-5 21 mbyte files on my desktop which cannot be deleted from Windows. Strange. I should mention that I'm testing the packages in VMware 5.0 RC2.

What am I doing wrong?


Regards,
FoLmEr
Se7eNdUsT
I also am having problems with 7-zip switchless installers.
I compress all the files I want, add 7zs.sfx and config.txt and make the .exe, all edited and works perfectly when tested - except if run during RunOnceEx. If I test with VMware 4.5.2, NeroBR, NVE3, Office2003 and SymantecAV9 do not install at all when run via RunOnceEx. If I run the .exe's after install then they install fine (both in VMware and not).

The 7-zip exe calls "Install.exe" which is just a converted .cmd file, basically following this format:

CODE
@ECHO OFF
cmdow @ /HID
ECHO.
TITLE Installing Symantec Antivirus
SymantecAntivirus.msi /qn reboot=reallysuppress liveupdate=0 servergroupname=Username servergrouppass=Userpass
REGEDIT /S Fix.reg
RD /S /Q "%AllUsersProfile%\Start Menu\Programs\Symantec Client Security"
EXIT


SymantecAV and Office2003 are .msi's and both Nero's are .exe's and they both work fine otherwise. Is there something 'pre-first boot' that won't work such as "cmdow @ /HID"?

Cheers for your help.
Sevendust.

-EDIT-
Telling 7-Zip to load Install.cmd rather than converted Install.exe worked a treat.

Astalavista, you seem to use the Quick Batch file Compiler a lot. Know the reason?
keytotime
@Se7eNdUsT

Try Calling the .cmd directly.
Se7eNdUsT
Cheers keytotime. Reading that 7-Zip couldn't call .msi's I wasn't game to try anything other than .exe's. I'll try now.
EDIT: You're a champ, keytotime. It worked like a charm. Cheers.

Reply to FoLmEr:
Instead of getting the 7-Zip to call StartX.exe with additional paramters, try creating a .cmd file which then calls the msi. Before compiling the 7-Zip sfx, try running the cmd file by itself to test if it works.
FoLmEr
It didn't work calling the cmd from 7zip, although it did work just executing the cmd directly from the directory.
CODE
;!@Install@!UTF-8!
RunProgram="run.cmd"
;!@InstallEnd@!

run.cmd:
CODE
CMDOW @ /HID
@ECHO OFF

start /wait IP4_1.msi MM=14 /QB REBOOT=ReallySuppress

REGEDIT /S ip412.reg

EXIT

It is as if 7zip ONLY wants to call setup.exe because that is the errer I get: A small box titled 7zip and text saying "Can not find setup.exe". This is strange since I've nowhere mentioned setup.exe. Doesn't 7zip execute the install command in the directory it has just extracted to (I think it should but I'm starting to doubt it.)? Then, if the install command is unavailable - which it isn't - it launches the default "setup.exe". Well, if no one can give me an explaination to this behavior, I'm starting to smell a serious bug...

BTW what's the advantage of using the StartX.exe method as the guide describes as opposed to a .cmd file?

And I just testet that even WinRAR works with the .cmd. I'm afraid I'm about to give up on 7zip if I don't find a solution sad.gif

Regards,
FoLmEr
Astalavista
KEYTOTIME u are the best. your guide is fantastic

i understood it and applied it right away without any problems.

best regards.
VATERNL
Ok...you will all call me a newbie, but where do I place the code?
This part totally confuses me atm.

The guide is not really clear on that part ( for me ) blink.gif

Can someone explain this part of the guide a bit more blushing.gif

Thx in advance.

VATERNL -NEWBIE-
vcBlackBox
QUOTE (FoLmEr @ Mar 3 2005, 03:52 AM)
It didn't work calling the cmd from 7zip, although it did work just executing the cmd directly from the directory.
CODE
;!@Install@!UTF-8!
RunProgram="run.cmd"
;!@InstallEnd@!

run.cmd:
CODE
CMDOW @ /HID
@ECHO OFF

start /wait IP4_1.msi MM=14 /QB REBOOT=ReallySuppress

REGEDIT /S ip412.reg

EXIT

It is as if 7zip ONLY wants to call setup.exe because that is the errer I get: A small box titled 7zip and text saying "Can not find setup.exe". This is strange since I've nowhere mentioned setup.exe. Doesn't 7zip execute the install command in the directory it has just extracted to (I think it should but I'm starting to doubt it.)? Then, if the install command is unavailable - which it isn't - it launches the default "setup.exe". Well, if no one can give me an explaination to this behavior, I'm starting to smell a serious bug...

BTW what's the advantage of using the StartX.exe method as the guide describes as opposed to a .cmd file?

And I just testet that even WinRAR works with the .cmd. I'm afraid I'm about to give up on 7zip if I don't find a solution sad.gif

Regards,
FoLmEr
*



QUOTE
Doesn't 7zip execute the install command in the directory it has just extracted to
It should.
QUOTE
BTW what's the advantage of using the StartX.exe method as the guide describes as opposed to a .cmd file
By using StartX.exe in combination with the /wait, you are forcing it to complete the script (run.cmd) before it continues to your next command in your batch file.
DigitalAZ
QUOTE (Astalavista @ Mar 3 2005, 03:17 AM)
KEYTOTIME u are the best. your guide is fantastic

i understood it and applied it right away without any problems.

best regards.
*


KEYTOTIME,

I know prior MSI experience is probably required but so many have touted how easy this guide is to follow. I have tried it about 20 times with different apps .exe and.msi and cannot get one successful package. So bear with me I am going to try and hash out what I am doing and maybe some of the veterans can help me out.

Your instructions translated by a noob.
1 Download and install the latest version of 7-Zip.
Easy enough. I had 7-zip installed. (Success!)

2 Make a folder to copy all of the installation files to. If you are using a .msi include StartX.exe in the folder.

Copy all the installation files? I assumed you were referring to any files required to install the application we are trying to package. If I am using .msi I must include StartX.exe in the folder with the installation files. (Success)

3 Select all of them and right click on any file.

Select all the installation files and archive them with 7zip. (Success)

4 Select "Add to archive...", which is under the select option..
Ok...
5 You can make the archive name to whatever you want it to be. Set the compression level to Ultra.

Created "Fake Application.7z" (Success)
6 Hit OK. Once the archive is created, you can delete all files except the archive.

Delete all installation files except "Fake Application.7z" (Success)

7 Go to the 7-Zip directory and copy 7zS.sfx to the folder containing the archive.

Copied 7zS.sfx from Program Files\7-zip to folder with Fake Application.7z (Success)

8 If you want, you can change the icon of the installer by replacing the icon in 7zS.sfx using ResHacker. For example, you can use the icon from the main program. Remember to save 7zS.sfx when you're finished.

Umm assumed this was optional. Didn't do this.

9 Open Notepad and add the following:

created config.txt
CODE
;!@Install@!UTF-8!
RunProgram="StartX.exe /WAIT \"msiexec /i Fake Application.msi /qb-!\""
;!@InstallEnd@!


10 Save as config.txt with UTF-8 encoding by selecting "UTF-8" from the dropdown menu in the "Save As..." dialog in Notepad. Save it to the same folder as 7zS.sfx and the 7z archive.

Saved as UTF-8 text file in the folder with Fake Application.7z (Success)

11 The folder should now look something like this:

My folder consists of :
Fake Application.7z
config.txt
7zS.sfx

12 Open a command prompt. CD to the folder. Then enter the following command:

Typed following in cmd prompt window in folder with 3 files listed above.
CODE
copy /b 7zS.sfx + config.txt + "Fake Application.7z" "Fake Application.exe"

Your guide says 7zx.sfx I assumed it was 7zS.sfx.
CODE
7zS.sfx
config.txt
Fake Application.7z
       1 file(s) copied.


That's it, you're done. Try it out.

Launch Fake Application.exe and it extracts but displays the MSI Installer switches dialog.

When trying to create packages with the .exes I had no luck and when trying with the .msi it extracts to the temp folder and I can go into the C:\Temp\7zS4C.tmp and see the contents of my package extracted. The package however just prompts me with the Windows Installer dialog that shows you with all the switches which led me to believe I used the wrong switch. I tried several combinations from the list displayed without any success.

Any glaringly obvious mistakes I have made?

Thanks for your time blink.gif

EDIT : Hrm must be a quote tag limit LOL whistling.gif
keytotime
Is the name of the app under 8 characters and has no spaces? Here are two of mine that work. Thank's i fixed the typo.

CODE
;!@Install@!UTF-8!
RunProgram="StartX.exe /WAIT \"msiexec /i sav.msi /qb-! RUNLIVEUPDATE=0 REBOOT=REALLYSUPPRESS\""
;!@InstallEnd@!


CODE
;!@Install@!UTF-8!
RunProgram="StartX.exe /WAIT \"msiexec /i sav.msi /qb-! RUNLIVEUPDATE=0 REBOOT=REALLYSUPPRESS\""
;!@InstallEnd@!
DigitalAZ
QUOTE (keytotime @ Mar 13 2005, 05:25 AM)
Is the name of the app under 8 characters and has no spaces?


Ok with that knowledge I now I have working 7-zip installers! Thank you for your patience.
keytotime
Thank's to you i was unaware of that before. thumbup.gif Updated first page.

@FoLmEr.

Try this
CODE
CMDOW @ /HID
@ECHO OFF

start /wait msiexec /i IP4_1.msi MM=14 /QB-! REBOOT=ReallySuppress

REGEDIT /S ip412.reg

EXIT
Astalavista
DigitalAZ

it u are hving problems with keytotime guide

i have a video! yes a video on how to 7zip office 2003

check the link on my sig

keytotime

u are welcome to link or use my video as a ref to making 7zip.

smile.gif
ahmedwa
i write this Autoit Code to auto creat .7z files or .exe(from sfx Files)
but ExE file after built not run the program in SFX comint it alwyes run setup.exe

i don't know wherr is error??!!!


;----------------------------------------------------------------------------
; AutoIt Version: 3.1.0
; Author: Ahmed Bayomy
; ----------------------------------------------------------------------------
if not FileExists("7za.exe") then FileCopy(@ProgramFilesDir & "\7-zip\7za.exe",@ScriptDir & "\7za.exe")
if not FileExists("7z.sfx") then FileCopy(@ProgramFilesDir & "\7-zip\7z.sfx",@ScriptDir & "\7z.sfx")
if not FileExists("7zs.sfx") then FileCopy(@ProgramFilesDir & "\7-zip\7zs.sfx",@ScriptDir & "\7zs.sfx")

if $CmdLine[0] =0 then
MsgBox(0,"Help","Parameters : " & @CRLF & " Folder name to creat 7z file " & @CRLF & " /SFX to creat .EXE " & @CRLF & " Filename to make .exe with autorun this file")
Exit
EndIf

dim $Command,$File
$7zFile='"' & $CmdLine[1] & '.7z"'
$Command="7za.exe a -t7z -mx9 " & $7zFile & ' "' & $CmdLine[1] & '\*" -r -y'
RunWait($Command,"",@SW_HIDE )
if $CmdLine[0] >1 then
if $CmdLine[2]="/SFX" Then
RunWait(@ComSpec & " /c " & "Copy /b " & @ScriptDir & "\7z.sfx + " & $7zFile & ' "' & $CmdLine[1] & '.exe"',"",@SW_HIDE)
FileDelete($7zFile)
Else
;~ -----------------------------
dim $7TXT
$7TXT=FileOpen(@ScriptDir & "\7z.txt",2)
FileWrite($7TXT,";!@Install@!UTF-8!" & @CRLF)
FileWrite($7TXT,"RunProgram=" & '"' & $CmdLine[2] & '"' & @CRLF)
FileWrite($7TXT,";!@InstallEnd@!" & @CRLF)
RunWait(@ComSpec & " /C " & 'Copy /b "' & @ScriptDir & '\7zs.sfx" + "' & @ScriptDir & '\7z.txt" + ' & $7zFile & ' "' & $CmdLine[1] & '.exe"');,"",@SW_HIDE)
EndIf
EndIf




Google Internet Forums Unattended CD/DVD Guide

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.