I recently had a requirement to create a Self-Extracting Executable and I automatically thought of using WinRaR to accomplish this task.
Tools such as 7-Zip and WinZip also accomplish this, but the functionality for doing this is not built into the tools. 7-Zip requires extra modules to create this while WinZip requires the purchase of a separately licensed piece of software called WinZip Self-Extractor.
Therefore, for the $29 price tag of WinRaR, the ability to create Self-Extracting Executables directly without any additional modules or licensed software is definitely appealing.
Unfortunately, the documentation/help file for creating an SFX using WinRaR is pretty poor. Therefore, it took a few hours of playing around with different command-line switches before I finally came across the right combination.
Ultimately, I used a commands text file that is provided in the Help documentation as the following text:
Title=Calculator 3.05
Text
{
Calculator is shareware. Anyone may use this
software during a test period of 40 days.
Following this test period or less, if you wish
to continue to use Calculator, you MUST register.
}
Path=Calculator
Overwrite=1
Setup=setup.exe
This was the PowerShell script that I used to run WinRaR:
Tools such as 7-Zip and WinZip also accomplish this, but the functionality for doing this is not built into the tools. 7-Zip requires extra modules to create this while WinZip requires the purchase of a separately licensed piece of software called WinZip Self-Extractor.
Therefore, for the $29 price tag of WinRaR, the ability to create Self-Extracting Executables directly without any additional modules or licensed software is definitely appealing.
Unfortunately, the documentation/help file for creating an SFX using WinRaR is pretty poor. Therefore, it took a few hours of playing around with different command-line switches before I finally came across the right combination.
Ultimately, I used a commands text file that is provided in the Help documentation as the following text:
Title=Calculator 3.05
Text
{
Calculator is shareware. Anyone may use this
software during a test period of 40 days.
Following this test period or less, if you wish
to continue to use Calculator, you MUST register.
}
Path=Calculator
Overwrite=1
Setup=setup.exe
This was the PowerShell script that I used to run WinRaR:
$ZipFile = "C:\Temp\Temp.zip"
$CmdsFile = "C:\Temp\Test.txt"
$WinRarExe = "C:\Program Files\WinRAR\WinRAR.exe"
$RarFileArgs = @"
a -sfx $ZipFile -z$CmdsFile
"@
Write-Host """$WinRarExe""" $RarFileArgs
Start-Process $WinRarExe $RarFileArgs
This is also a variation that allows creating an SFX directly:
$ZipFile = "C:\Temp\Temp.zip"
$CmdsFile = "C:\Temp\Test.txt"
$WinRarExe = $Env:ProgramFiles + "\WinRAR\WinRAR.exe"
$RarFileArgs = @"
s $ZipFile -z$CmdsFile
"@
Write-Host """$WinRarExe""" $RarFileArgs
Start-Process $WinRarExe $RarFileArgs
No comments:
Post a Comment