Jump to content

7z Self extracting


ipen

Recommended Posts

Hello all,

I been trying to create a self extracting zip (SFX) to contain my installation folder.

I am using 7z modules like "7zs.Sfx" or "7zSD_Lzma.sfx".

I created a zip which after extraction run the "setup.exe" .

this is the command lines in the batch file :

"C:\Program Files\7-Zip\7z.exe" a %zipFileName% %allFromOutputDir% (creating a 7z zip)

copy /b "C:\Program Files\7-Zip\7zS.sfx" -y + MCTSFXConfig.txt + %zipFileName% %outputFile% (Creating self extracting zip)

this is the config content :

;!@Install@!UTF-8!

RunProgram="setup.exe"

GUIMode="2"

;!@InstallEnd@!

On my comuter which OC is win7 - it works good!

But when i try to run it on WinXP pro x86

i get this error after extraction :

"This installation package could not be opened..."

So i tried different command for SFX :

"C:\Program Files\7-Zip\7z.exe" a %zipFileName% %allFromOutputDir%

copy /b "C:\Program Files\7-Zip\7zSD_LZMA.sfx" + MCTSFXConfig.txt + %zipFileName% %outputFile%

and when i am trying to run its out put - i get this error :

"Could not read configuration or configuration not found".

NOTE : it is the same configuration...

Please help !

Link to comment
Share on other sites


  • 2 weeks later...

You can try to use 7zsd.sfx ! And check if your config.txt is saved in UTF-8 encoding:

Downloads

Create your batch file config.bat inside your folder location and after you created the archive with 7zip, launch the batch file, to create the exe file:

config.bat (example for folder.exe, using 7zsd.sfx module)

@copy /b 7zsd.sfx + config.txt + folder.7z folder.exe

Edited by myselfidem
Link to comment
Share on other sites

I created a zip which after extraction run the "setup.exe" .

this is the command lines in the batch file :

"C:\Program Files\7-Zip\7z.exe" a %zipFileName% %allFromOutputDir% (creating a 7z zip)

copy /b "C:\Program Files\7-Zip\7zS.sfx" -y + MCTSFXConfig.txt + %zipFileName% %outputFile% (Creating self extracting zip)

Where did you found this method? Strange! :blink:

Edited by myselfidem
Link to comment
Share on other sites

I can assure that 7-zip selfextractor do normally work on 2K and XP.

Casbah and it's predecessors make use of a similar approach, and have worked allright since a few years, so what you report is strange:

http://reboot.pro/4023/

maybe you can find something that has been overlooked by comparing what you do with the contents of the "historical threads":

http://www.911cd.net/forums//index.php?showtopic=18845&hl=

http://reboot.pro/628/

http://www.911cd.net/forums//index.php?showtopic=21123

jaclaz

Link to comment
Share on other sites

Hmmm... one would assume the CONFIG.TXT is as follows -

7zSD.sfx Windows version for installers (uses MSVCRT.dll).
(using the one linked to by myselfidem...)
Installer Config file format

This config file contains commands for the Installer. The file begins with the string ;!@Install@!UTF-8! and ends with ;!@InstallEnd@!. The file must be written in UTF-8 encoding.

This "setup.exe' is compatible with both OS', right? (you never even said what it is / where it's from...)
Link to comment
Share on other sites

Hi,

Tried all the above - still same errors.

I have a VS.net setup project - creating my setup.exe file.

Then i have a post build event - trying to create the SFX like this :

"C:\Program Files\7-Zip\7z.exe" a %zipFileName% %allFromOutputDir%

copy /b "C:\Program Files\7-Zip\7zS.sfx" + config.txt + %zipFileName% %outputFile%

When running its product - it cause this error :

"This installation package could not be opened..."

or like this

"C:\Program Files\7-Zip\7z.exe" a %zipFileName% %allFromOutputDir%

copy /b "C:\Program Files\7-Zip\7zSD_LZMA.sfx" + config.txt + %zipFileName% %outputFile%

When running its product - it cause this error :

"Could not read configuration or configuration not found".

config file is saved in UTF-8 encoding.

NOTE : both errors only happen on win XP .

On win 7 - it works great!!!

Any other suggestions ?

Edited by ipen
Link to comment
Share on other sites

Are all apps involved, both the ones you make and the tools used to make them, all 32 bit apps? No 64 bit apps are there? Are both your installations of XP and Win7 32 bit versions?

Cheers and Regards

Link to comment
Share on other sites

Tried all the above - still same errors.

I have a VS.net setup project - creating my setup.exe file.

Maybe you need to check if your VS.net creating your customized setup.exe is compatible with Windows XP?

Link to comment
Share on other sites

I have a VS.net setup project - creating my setup.exe file.
BWAHAHAHAH!!!! You need dotNET Runtime installed BEFORE running the Install App, I betcha!!!! Notice that that tiny little detail (the quote) was what you neglected to tell anyone.

XP does NOT install dotNet "by default", but... Win7 DOES!!!! :lol:

Edited by submix8c
Link to comment
Share on other sites

Look,

The setup alone does work on both OS... (XP and win 7).

Only after creating SFX and using it - it does not work on win XP.

And yes - the setup pre-requisite is to install .net frame work.

Any other suggestions ?

Thanks

Iris

Link to comment
Share on other sites

YES!!!!!

Riddle me this, Batman!

WHAT is the ACTUAL value of variable

%allFromOutputDir%

This may help, since this is CREATED on Win7...

edit - AMAZING!!!!!

1 - I first 7-zipped notepad.exe (JUST THAT and NOT the Folder)

2 - I then created a config.txt EXACTLY like yours (changed pgm to NOTEPAD.EXE)

3 - I then ran this command

copy /-Y /B 7zsd.sfx+config.txt+notepad.7z 7ztest.exe

4 - I then double-clicked 7ztest.exe - NOTEPAD OPENED!!!

Dude, you are doing something WRONG!!!! See MY "copy" command! YES, it DOES work!

Please note I used this one...

Edited by submix8c
Link to comment
Share on other sites

It's not the best way to create your SFX file inside the folder: C:\Program Files\7-Zip

But, if you need for both architecture: 32-bit and 64-bit you need to use 7zsd_All.sfx module

All module versions (7zSD) for installers use MSVCRT.dll (Microsoft Visual C runtime library). In other words, some functions are performed via this dynamic library, and this helps reduce the module size. This file is present in all operating systems supported by the module. Old module versions (7zS) that did not require MSVCRT.dll are no longer supported.

I create an SFX file inside this folder for Scanjet 3970 series drivers (as example), like this:

config.bat


@echo off
if exist "%~dp0Scan3970.7z" del /f /q "%~dp0Scan3970.7z"
echo.
cd "%~dp0Scan3970"
"%~dp07z.exe" a -t7z -mx9 -y "%~dp0Scan3970"
@copy /b /y "%~dp07zsd.sfx" + "%~dp0Scan3970.txt" + "%~dp0Scan3970.7z" "%~dp0Scan3970.exe"
pause

Scan3970.txt


;!@Install@!UTF-8!
; Mode silencieux pour HP Scanjet3970 series x86
GUIMode="2"
RunProgram="hidcon:cmd /c xcopy \"%%T\\*.*\" %SYSTEMDRIVE%\\Drivers\\Scanjet\\ /s /e /i /y"
RunProgram="%SYSTEMDRIVE%\\Drivers\\Scanjet\\DPInst32.exe /SW"
;!@InstallEnd@!

Output result


7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning

Creating archive C:\Program Files\7-Zip\Scan3970.7z

Compressing installdrvs.cmd
Compressing DPInst.xml
Compressing DPInst.txt
Compressing hpgt3970.cat
Compressing hpgt3970.inf
Compressing DPInst32.exe
Compressing DPInst64.exe
Compressing DPInstLaunch.exe
Compressing hp3970co.dll
Compressing x64\hp3970co.dll
Compressing hpgt3970.dll
Compressing x64\hpgt3970.dll
Compressing hpst3970.dll
Compressing hpxp3970.dll
Compressing x64\hpxp3970.dll
Compressing hpusbscn.sys

Everything is Ok
C:\Program Files\7-Zip\7zsd.sfx
C:\Program Files\7-Zip\Scan3970.txt
C:\Program Files\7-Zip\Scan3970.7z
1 fichier(s) copié(s).
Appuyez sur une touche pour continuer...

*Edit:

Tested also on XP and works fine!

It seems with Windows XP, there is an subfolder inside your temp folder!

HTH

Edited by myselfidem
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...