Skip to content

Instantly share code, notes, and snippets.

@thnk2wn
Last active September 29, 2021 08:24
Show Gist options
  • Save thnk2wn/e66b0c273790e5f2fe0d815308c8d9f5 to your computer and use it in GitHub Desktop.
Save thnk2wn/e66b0c273790e5f2fe0d815308c8d9f5 to your computer and use it in GitHub Desktop.
@echo off
if "%1" == "" goto usage
REM Expecting trailing \ on folders passed in
set artifactsFolder=%1
set folderToBackup=%artifactsFolder%deployPackage\
set zipLocation=%artifactsFolder%
set buildFolder=%~dp0
set zipFilename=%zipLocation%DeployMyApp.7z
set zipExe=%zipLocation%DeployMyApp.exe
echo Artifacts folder is %artifactsFolder%
REM Create the zip file
7za.exe a %zipFilename% %folderToBackup%
REM combine SFX (Self Extracting Archive), install config text file, & zip file into EXE
copy /b 7zS.sfx + Zip-Install-Config.txt + %zipFilename% %zipExe%
REM delete zip file now that we have self extracting archive exe
del /q /f %zipFilename%
REM if a second parameter treat as a directory to copy exe to
IF NOT "%2" == "" xcopy /y /r %zipExe% %2
goto exit
:usage
echo Expected an artifacts folder with trailing backslash as the 1st parameter.
echo 2nd parameter is an optional folder to copy zip exe to.
:exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment