Jump to content


Photo

[Tutorial] Making A 7-Zip Switchless Installer


  • Please log in to reply
19 replies to this topic

#1 ricktendo

ricktendo

    Group: Banned

  • Global Mods
  • 8,685 posts
  • Location:La Ceiba
  • OS:Windows 8 x64

Posted 25 October 2007 - 07:20 PM

Time for a new Tutorial. At first there are new versions of all the stuff that's needed. Secondly are there much improvements and is there an easier way to make a 7-Zip Installer now. Third: I think most people don't know this all.

Tutorial:
1. Download the right 7zSD (always linked to latest version). Extract and place the 7zsd.sfx in a new folder.
2. Go to here and download the 7za***.zip (where *** is the version number) from the latest 7-Zip command line version. Extract and place only the 7za.exe in the same folder as 7zSD.
3. Download UPX here. Extract and place only the upx.exe in the folder where 7zSD and 7za are placed.
4. Make a subdirectory with the name Bin and copy all installation files to.
5. If you want, you can change the icon of the installer by replacing the icon in 7zsd.sfx using ResHacker as described here.
6. You can also change the version info of the executable using ResHacker. Go to the folder Version Info in ResHacker by opening 7zsd.sfx and rename the values of "CompanyName" and "FileDescription".
7. Create a Config.txt in the same folder as 7zSD, 7za and UPX.

Open it and set:

RunProgram="program.exe -switch"

Replace program.exe with the name of your installer (including the extension). Replace -switch with the desired switch(es) to be used. Many switches of different programs can be found here.

For a full silent 7-Zip install you add:

GUIMode="2"

It's not needed any more to add StartX.exe, msistub.exe or other supplementary tools. Then "waiting" is enabled by default for 'RunProgram=', unless 'nowait:' parameter is used. Also reg-files aren't needed any more. They can be configured in the Config.txt.

For a Register Entry (If you use a lot of Register Entries it's smart to use the parameter SetEnvironment to save time):

RunProgram="hidcon:cmd Register Entry"

Keep this in mind: you MUST use DOUBLE backslashes (\\) wherever you normally use backslashes (\) (e.g. in paths or dialog texts). Similarly, if the Value contains double quotes ("), you MUST precede them with a backslash (\").

Now, your Config.txt looks like this:

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="program.exe -switch"
RunProgram="hidcon:cmd Register Entry"
;!@InstallEnd@!

You can add, edit and remove lines if you want.

* All available configuration parameters and other helpful information can be found here (site is just translated from Russian to English).

8. Save Config.txt with UTF-8 encoding by selecting "UTF-8" from the dropdown menu in the "Save As..." dialog in Notepad.
9. Make a Create.cmd in the same folder as the Config.txt and past the following:
upx --ultra-brute 7zsd.sfx 
cd Bin
..\7za a -mx=9 "..\Program.7z" * 
cd ..
copy /b 7zsd.sfx + Config.txt + Program.7z Program_Name.exe
del Program.7z
10. Rename Program_Name to your own program name and run your Create.cmd.
11. Congratulations: you have guaranteed the littlest 7-Zip Installer as possible.

Tool:
Utility that can extract 7z archive and config file (Config.txt) as well as SFX module (7zsd.sfx) from 7z SFX archive. It has the name 7z SFX Archive Splitter (from the 7z SFX creator) and you can download it here (always linked to latest version).

EnJoy. :D
  • NIM likes this

#2 DarkNite

DarkNite

    Lurker

  • Members
  • Pip
  • 2 posts
  • Location:Purgatory

Posted 07 November 2007 - 10:56 AM

Thank you! That was much easier for me than the last time I made one. :)

#3 DEViANCE

DEViANCE

    Advanced Member

  • Members
  • PipPipPip
  • 57 posts
  • OS:Windows 7

Posted 07 December 2007 - 04:10 AM

This works great for me but i have a question, say i wanted to copy a file/folder from the bin directory to the install directory of the app after i had run the install.. how would i do that?? For example i have some updated NOD32 files i want to add after running the install (replacing out of date ones) so i don't have to download them again.

#4 ricktendo

ricktendo

    Group: Banned

  • Global Mods
  • 8,685 posts
  • Location:La Ceiba
  • OS:Windows 8 x64

Posted 07 December 2007 - 04:50 AM

You can find manny examples on how to do that in the help file http://7zsfx.solta.r...parameters.html

Example:
;!@Install@!UTF-8!GUIMode="2"RunProgram="setup.exe /s"RunProgram="hidcon:cmd /c xcopy FolderName \"%ProgramFiles%\\FolderName\" /s /e /i /y";!@InstallEnd@!


#5 DEViANCE

DEViANCE

    Advanced Member

  • Members
  • PipPipPip
  • 57 posts
  • OS:Windows 7

Posted 07 December 2007 - 06:55 AM

Thanks for the link and example! I tried that and it all worked well apart from ther are two files in the update folder "lastupd.var" ad "upd.var" its copying all the other files but those two are not getting over writen. could you kindly tell me how to delete/overwrite the two files, thanks ;-)

#6 ricktendo

ricktendo

    Group: Banned

  • Global Mods
  • 8,685 posts
  • Location:La Ceiba
  • OS:Windows 8 x64

Posted 07 December 2007 - 01:43 PM

1st Try these other xcopy switches (to see more in the CMD prompt type xcopy /?)
;!@Install@!UTF-8!GUIMode="2"RunProgram="setup.exe /s"RunProgram="hidcon:cmd /c xcopy FolderName \"%ProgramFiles%\\FolderName\" /s /e /i /y /h /r /k";!@InstallEnd@!

2nd If that does not work try to rename the files before xcopy
;!@Install@!UTF-8!GUIMode="2"RunProgram="setup.exe /s"RunProgram="hidcon:cmd /c  ren \"%ProgramFiles%\\FolderName\\lastupd.var\" lastupd.bak"RunProgram="hidcon:cmd /c  ren \"%ProgramFiles%\\FolderName\\upd.var\" upd.bak"RunProgram="hidcon:cmd /c xcopy FolderName \"%ProgramFiles%\\FolderName\" /s /e /i /y /h /r /k";!@InstallEnd@!


#7 DEViANCE

DEViANCE

    Advanced Member

  • Members
  • PipPipPip
  • 57 posts
  • OS:Windows 7

Posted 07 December 2007 - 08:58 PM

Nice one, this code worked fine:

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="setup.exe /s"
RunProgram="hidcon:cmd /c xcopy FolderName \"%ProgramFiles%\\FolderName\" /s /e /i /y /h /r /k"
;!@InstallEnd@!

I have now finished my first silent install and nlite addon now, thanks for your help ;-)

EDIT: can you please show me an example of how to add reg entries:

RunProgram="hidcon:cmd Register Entry"

I need to convert file this to the above format as it don't seem to work as a file:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Eset\Nod\CurrentVersion\Info]
"Build"="0x00002c76 (11382)"
"CurrentVersion"="2711 (20071207)"
"Date"="0x060c07d7 (101451735)"

The Build, and CurrentVersion need adding, the date needs updating. Sorry for all the questions.

EDIT: think i got it now:

RunProgram="hidcon:cmd REG ADD HKLM\SOFTWARE\Eset\Nod\CurrentVersion\Info /v Build /t REG_DWORD d/ 0x00002c76 (11382)"
RunProgram="hidcon:cmd REG ADD HKLM\SOFTWARE\Eset\Nod\CurrentVersion\Info /v CurrentVersion /t REG_SZ d/ 2711 (20071207)"
RunProgram="hidcon:cmd REG ADD HKLM\SOFTWARE\Eset\Nod\CurrentVersion\Info /v Date /t REG_DWORD d/ 0x060c07d7 (101451735) /f"

EDIT: sigh.. it don't seem to work if i do it from .reg file or config.txt... if i run the reg file or commands in windows it works.. why won't it work in the install?? What am i doing wrong?

Edited by DEViANCE, 08 December 2007 - 12:29 AM.


#8 Raoul

Raoul

    WinCert Friend

  • Members
  • PipPipPipPip
  • 274 posts
  • Location:The Netherlands
  • OS:Windows 7

Posted 12 May 2008 - 08:35 AM

I cant find any switches on de UAwiki?

I need switches for:
- CCleaner --> /S
- Raxco PerfectDisk --> /qn
- Foxit Editor


Doing it right like this? Only need to fill in switches, im new with those silent installers.

;!@Install@!UTF-8!
GUIMode="2"
RunProgram="ccsetup207.exe -switch"
;!@InstallEnd@!

Edited by Raoul, 12 May 2008 - 10:22 AM.


#9 ricktendo

ricktendo

    Group: Banned

  • Global Mods
  • 8,685 posts
  • Location:La Ceiba
  • OS:Windows 8 x64

Posted 12 May 2008 - 01:16 PM

CMenu can find many switches

*Right Click* More Options->Installer Tools->Identify Installer

#10 loren

loren

    Member

  • Members
  • PipPip
  • 21 posts
  • OS:Windows XP Pro

Posted 24 October 2008 - 07:31 AM

http://www.uawiki.or...a...db:overview

this url for switches is not available,could you give me the other one?

thanks

#11 loren

loren

    Member

  • Members
  • PipPip
  • 21 posts
  • OS:Windows XP Pro

Posted 24 October 2008 - 07:52 AM

and how to del any reg?

#12 YumeYao

YumeYao

    Advanced Member

  • Members
  • PipPipPip
  • 93 posts
  • Location:Taiyuan, Shanxi Province, PR China
  • OS:Windows 7

Posted 24 October 2008 - 08:31 AM

use "REG DELETE HKxx\xxxx"

#13 ricktendo

ricktendo

    Group: Banned

  • Global Mods
  • 8,685 posts
  • Location:La Ceiba
  • OS:Windows 8 x64

Posted 24 October 2008 - 03:49 PM

and how to del any reg?

Will show you in my series of videos http://www.wincert.n...?showtopic=4659

Look inside SilentSwitchMaker you will find a CHM help file with an example of how to use REG DELETE with this, it goes something like this

RunProgram="InstallerName.exe /switch"
RunProgram="hidcon:reg delete \"hkcu\\Software\\Example\" /f"


#14 Gunso

Gunso

    Lurker

  • Members
  • Pip
  • 1 posts
  • OS:Windows XP Home

Posted 08 November 2008 - 01:49 PM

Sorry for the stupid question... looks very complicated and need a lot of utilities to create a 7z Switchless Installer using this method, why not use the AutoIt method then a create 7zSFX or RARSFX, size will be more or less the same?

#15 ricktendo

ricktendo

    Group: Banned

  • Global Mods
  • 8,685 posts
  • Location:La Ceiba
  • OS:Windows 8 x64

Posted 08 November 2008 - 03:09 PM

Sorry for the stupid question... looks very complicated and need a lot of utilities to create a 7z Switchless Installer using this method, why not use the AutoIt method then a create 7zSFX or RARSFX, size will be more or less the same?

Heres a vid, will probably help explain a bit better

http://www.wincert.n...?showtopic=4659

#16 Geej

Geej

    Wincert Addict

  • Ultimate Sponsor
  • 625 posts
  • OS:Windows XP Pro

Posted 24 September 2009 - 04:48 AM

I have tried other GUI-based 7zfx maker. This commandline method suits me best. :D

#17 jonydread

jonydread

    WinCert Friend

  • Members
  • PipPipPipPip
  • 146 posts
  • Location:Chile
  • OS:Windows 7 x64

Posted 30 September 2011 - 03:41 PM

5. If you want, you can change the icon of the installer by replacing the icon in 7zsd.sfx using ResHacker as described here.


al editar opciones y guardar el antivirus me salta el exe como troyano?? como evito eso?
me pasa al cambiar el icono :S
EDIT: disculpen http://www.wincert.n...7212#entry77212

Edited by jonydread, 01 October 2011 - 12:35 AM.


#18 Jaanvi

Jaanvi

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • OS:Windows XP Pro

Posted 05 January 2014 - 02:11 PM

link of 7th step is not working.
And i do not understand 9th step that is how to make a create.cmd

#19 mooms

mooms

    Hello world !

  • Global Mods
  • 1,175 posts
  • Location:France
  • OS:Windows 7 x64

Posted 05 January 2014 - 05:31 PM

This tutorial is more than 6 years old, no wonder some links are dead !

@ricktendo: If you don't want/don't have time to update it, I can if you wish.

 

 

The 7zsd linked is the first post is a very old version, get latest stable version here: 7zSD

 

 

A cmd file is a text file with the extension changed, so you just have to create a new text file and paste the content, save it then change the file extension (*.txt to *.cmd)

 

 

About the content of the cmd file:

 

this

cd Bin
..\7za a -mx=9 "..\Program.7z" *
cd ..

can be simplified to this:

7za a "Program.7z" ".\Bin\*" -mx=9

So your cmd file look like this:

upx --ultra-brute 7zsd.sfx 
7za a "Program.7z" ".\Bin\*" -mx=9
copy /b 7zsd.sfx + Config.txt + Program.7z Program_Name.exe
del Program.7z

The first line

upx --ultra-brute 7zsd.sfx 

is optional, (UPX is an executable compressor, this commands is used to compress 7zsd.sfx)

 

so your cmd file should only have these 3 lines for beginning:

7za a "Program.7z" ".\Bin\*" -mx=9
copy /b 7zsd.sfx + Config.txt + Program.7z Program_Name.exe
del Program.7z

Also, all the steps that involve Resource Hacker are optionals, you should first familiarize yourself with these things, then you can change the icon, etc....

 

 

 

Two SFX maker (if you prefer using a GUI):

http://sourceforge.n...ects/sfx-maker/

http://www.isoft-online.com/



#20 Jaanvi

Jaanvi

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • OS:Windows XP Pro

Posted 06 January 2014 - 11:49 PM

thank you very much




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users