Page 1 of 1

7-Zip SFX Silent Launch Creator (Batch)

Posted: Tue Nov 23, 2010 10:45 am
by Stone Tablet
The following Batch can be used to create a Silent 7-Zip SFX that adds only 26KB (or less) to the native 7z file. This method is useful to save space and/or run any App directly from a CD. Comments?

START OF BATCH

@echo Off
ECHO............................................................................
ECHO.
ECHO. . . . 7 z S F X S i l e n t L a u n c h C r e a t o r . . . . . .
ECHO.
ECHO. Version 10.11.23
ECHO.
ECHO............................................................................
ECHO.
ECHO. This uses the files "7zS2.sfx" and "7zrv.exe" from the file
ECHO. "7z920_extra.7z" see (http://sourceforge.net/projects/sevenzip/files/)
ECHO.
ECHO. Place three files, (1) 7zs2.sfx, (2) 7zrv.exe and (3) this batch in a
ECHO. directory. Create a subdirectory called "LOAD_FILES_TO_ARCHIVE_HERE".
ECHO. Run Batch.
ECHO.
ECHO. Note: 3 levels of priorities are automatically used to select the "launch"
ECHO. file that is executed:
ECHO.
ECHO. 1) Files in root folder have higher priority than files in subfolders.
ECHO. 2) File extension priorities (from high to low priority order):
ECHO. bat, exe, inf, msi, cab (under Windows CE), html, htm
ECHO. 3) File name priorities (from high to low priority order):
ECHO. setup, install, run, start
ECHO.
ECHO. Before continuing,
ECHO.
ECHO. 1. Place "Portable" files in "LOAD_FILES_TO_ARCHIVE_HERE" sub-directory.
ECHO.
ECHO.
ECHO. Hit Control Break to Exit or
Pause
Cls
ECHO............................................................................
ECHO.
ECHO. ... Creating 7Z and EXE file (please wait)
ECHO.
ECHO............................................................................
ECHO.
7zrv a 7Z_Archive(LMZA2).7z .\LOAD_FILES_TO_ARCHIVE_HERE\* -mx9 -m0=lzma2
copy /b 7zS2.sfx + 7z_archive(LMZA2).7z "7Z_Archive (Portable 7zs XXX).exe"
cls
ECHO............................................................................
ECHO.
ECHO. D O N E ...
ECHO.
ECHO.
ECHO. Next Step(s)...
ECHO.
ECHO.
ECHO. 1. TEST the SFX!, If OK then...
ECHO.
ECHO. 2. Rename "7Z_Archive (Portable 7zs XXX).exe" to ...
ECHO.
ECHO. 3. Use Resource Hacker to change icon (Optional)...
ECHO.
ECHO. 4. Then run UPX to save ~7KB (Optional)...
ECHO.
ECHO............................................................................
ECHO. NOTE:
ECHO. The SFX will extract and launch from "..LOCAL SETTINGS/TEMP"
ECHO. These can be cleaned up with a simple batch when you dis-mount your USB.
ECHO. A SFX allows yaP and JPE portables to be used directly from a CD also...
ECHO. .... Enjoy! ....
Pause

Re: 7-Zip SFX Silent Launch Creator (Batch)

Posted: Tue Nov 23, 2010 1:53 pm
by Stone Tablet
Similar results can be obtained in the GUI version by deleting the files "7z.sfx" and "7zcon.sfx". Replacing the original with "7zs2.sfx" which has been renamed to "7z.sfx". Pick "Compression Level"="Ultra", Pick "Compression Method"="LZMA2" and Check the box "Create SFX Archive".