2 setlocal ENABLEDELAYEDEXPANSION
7 echo Usage
: 7zSD.
cmd ^
<input^
> ^
<output^
> ^
<title^
> ^
<fname^
>
11 REM Generate temp file names
12 set "SEVENZIP_SFX_CFG=%TMP%\~7zSD%RANDOM%%RANDOM%.cf"
13 set "SEVENZIP_SFX_ARC=%TMP%\~7zSD%RANDOM%%RANDOM%.7z"
15 REM Create the configuration file
16 echo ;^^
!@Install@^^
!UTF
-8^^
!> "%SEVENZIP_SFX_CFG%"
17 echo Title
="%~3">> "%SEVENZIP_SFX_CFG%"
18 echo ExecuteFile
="%~n4.exe">> "%SEVENZIP_SFX_CFG%"
19 echo ;^^
!@InstallEnd@^^
!>> "%SEVENZIP_SFX_CFG%"
21 REM Create the 7-Zip archive
22 "%~dp0\7za.exe" a
-t7z
"%SEVENZIP_SFX_ARC%" "%~1"
23 if %ERRORLEVEL% NEQ 0 (
24 del "%SEVENZIP_SFX_CFG%"
25 del "%SEVENZIP_SFX_ARC%"
29 REM Rename the embedded file
30 "%~dp0\7za.exe" rn
"%SEVENZIP_SFX_ARC%" "%~nx1" "%~n4.exe"
31 if %ERRORLEVEL% NEQ 0 (
32 del "%SEVENZIP_SFX_CFG%"
33 del "%SEVENZIP_SFX_ARC%"
37 REM Actually build the SFX file
38 copy /b
"%~dp0\7zSD.sfx" + "%SEVENZIP_SFX_CFG%" + "%SEVENZIP_SFX_ARC%" "%~2"
39 if %ERRORLEVEL% NEQ 0 (
40 del "%SEVENZIP_SFX_CFG%"
41 del "%SEVENZIP_SFX_ARC%"
46 del "%SEVENZIP_SFX_CFG%"
47 del "%SEVENZIP_SFX_ARC%"