Original Article link: http://www.msfn.org/board/topic/34343-winrar-sfx-commands/
Basic SFX Info :
(Windows 95, 98, NT and so on). [These modules can not be controlled under Windows 3.1 or DOS.]
Both Chinese modules support simple setup commands. You may put them to the SFX archive comment. Setup commands are listed below.
; Comment below contains SFX script commands
This is needed at the beginning of every comment section of the SFX.
Delete = [filename]
Delete the specified file in the destination folder before extraction. Several Delete commands are allowed.
If a file specified in the Delete command is locked and can not be deleted, SFX module will try to rename it to temporary name before extraction and delete after Windows reboot. Success of this operation depends on Windows version.
Examples :
Delete = winrar95.exe
Delete = rarlng.dll
License = [title of the license dialog]{
License text1
License text2
...
}
Display the software license when starting SFX. User may either accept it and continue extraction or decline and quit.
License may be either in HTML or plain text format. In the next case SFX module merges and reformats the specified text strings to fit them optimally into the dialog. So if you wish to start a new paragraph, you need to put the empty string before It.
Using HTML you may control colors, fonts and formatting of displayed text. Description of HTML syntax is available on The World Wide Web Consortium site. Also it is possible to use any web page editor program to prepare HTML text.
Examples :
License = End user license agreement
{
All copyrights to RAR are exclusive owned by the author
This program is shareware. Anyone may use this software during a test period.
Following this test period, you MUST register.
}
Path = [your path here]
Where to install the files contained in the SFX.
Examples :
Path =% systemdrive% \ WINDOWS \ System32
This installs to System32 in the Windows folder.
Path = AIM
This installs to Program Files \ AIM.
Path = Calc 3.05
Set the default path to "Program Files \ Calc 3.05":
Path = C: \ Calc
Set the default path to "C: \ Calc"
Path =. \ Calc
Set "Calc" folder without any preceding text as the default path:
Presetup = [program]
SF) will try to execute [program] before starting extraction. The destination folder is set as the current before executing [program]. You may use this command, for example, to remove a previous version of program, when installing a new version over The Old one. If a program name contains spaces, it must be enclosed in quotes.
Examples :
Presetup = uninstall.exe / clean
Runs "uninstall.exe" before setup / extraction.
SavePath
This command allows SFX to store the destination path entered by user to Registry and then restore it when SFX archive with the same parameter of Path command executed the next time. The original value of Path command is placed to the list associated with the destination path input Field, so a user may choose between prior imported and original paths.
This feature may be convenient when installing new versions or upgrades of some software to the same folder. It allow change the proposed path to desired only once again instead of retyping it every time.
SavePath command may be used only in combination with Path command.
Examples :
Path = Calc 3.05
SavePath
TempMode = [Question] [, Title]
This command force SFX to create a temporary folder, extract all files to it, start the program specified in Setup command and remove the temporary folder including all its contents after completing the Setup program. The SFX automatically sets the silent mode to skip the the start Dialog when encounter these operations. If TempMode command is present, a script should have command command and must not include Path command.
TempMode command may have the optional string parameter, which is used to define a question and question title displayed before extraction. In this case extraction is started only if user options "Yes" button.
Examples :
TempMode
Unpacks to temp folder.
TempMode = Do you wish to continue installation of Calculator 3.05 ?, Calculator setup
Creates temp folder, and containing dialog with text "Do you wish to continue installation of Calculator 3.05?"
Setup = [program]
SFX will try to execute <program> after successful extraction. The folder containing extracted files is set as the current before executing [program]. If a program name contains spaces, it must be enclosed in quotes.
Notes:
1) If you have problems to use SFX to run InstallShield setup.exe, try to execute "setup.exe / SMS" instead of simple "setup.exe". This switch allows SFX to detect termination of the InstallShield setup program.
2) All switches specified in SFX command line are passed to a program from Setup = <program> command. SFX itself understands only -s switch, which forces the silent install mode without displaying the start dialog.
3) SFX module sets sfxname environment variable before running the setup program. This variable contains the name of SFX archive, so setup program can read it if it needs such information.
Examples :
Setup = setup.exe
SFX will try to run "setup.exe".
Silent = X
Where X can be:
1 = Start dialog is unnaturally, including the progress bar and file names.
2 = Confirmation to start is skipped, but users still see performing of the archive unpacking.
This is the setting for what you want displayed on the screen.
Examples :
Silent = 2
This displays the unzipping box, but no pop-up messages.
Text = [string]
Or
Text{
String1
String2
...
}
This adds the specified plain text or HTML strings to the text output window of SFX module. When SFX module encounters Text command the first time, it resets the default contents of this window before adding [string]. Following commands append [string] to the Already existing text
On the used syntax this command may add either a single string or several strings at once.
In case of plain text contents SFX module merges and reformats the specified text strings to fit them optimally into the dialog. So if you wish to start a new paragraph, you need to put the empty string before it.
Using HTML you may control colors, fonts and formatting of displayed text. Description of HTML syntax is available on The World Wide Web Consortium site. Also it is possible to use any web page editor program to prepare HTML text.
Examples :
Text = Here is my new program
Add the single string to the dialog window
Text
{
Most interesting features of this program are:
- support of the Windows Clipboard;
- processing of files up to 10KB size each;
}
Add the specified text to the dialog window
Overwrite = X
Where X can be:
0 = User will be asked before overwriting files
1 = Overwrite the file if it exists without confirmation
2 = All existing files will not be over
This is the setting for whether the SFX should overwrite the file if it exists.
Examples :
Overwrite = 1
This means: YES, overwrite.
Shortcut = X, "PATHTOPROGRAM", "SUBMENU", "DESCRIPTION", "SHORTCUTNAME"
Where X can be:
D = Desktop
S = Start Menu
P = Start Menu / Programs
T = Startup
This one makes a shortcut. Replace the variables with real ones
Also, if there is some way to install shortcuts to locations other than the ones I have listed, please let me know.
Examples :
Shortcut = P, "mplayerc.exe", "Media Player", "Media Player Classic v6.4.8.2", "Media Player Classic"
This creates a shortcut to the mplayerc.exe file in the SFX (no matter where it is installed to), in Start -> Programs -> Media Player . The shortcut tooltop (when you move your mouse over it) displays Media Player Classic v6 .4.8.2 , and the options itself is named Media Player Classic .
Shortcut = P, "mplayerc.exe", "", "Media Player Classic v6.4.8.2", "Media Player Classic"
This creates a shortcut to the mplayerc.exe file in the SFX (no matter where it is installed to), in Start -> Programs . The shortcut tooltop (when you move your mouse over it) displays Media Player Classic v6.4.8.2 , And the options itself is named Media Player Classic .
Title = [title]
Set a title of SFX window.
Examples :
Title = Calculator, version 3.05
; Comment below contains SFX script commandsPath =% systemdrive% \ WINDOWS \ System32
SavePath
Silent = 1
Overwrite = 1
Shortcut = P, "mplayerc.exe", "", "Media Player Classic v6.4.8.2", "Media Player Classic"
Edited December 16, 2004 By a06lp
Another link to use WinRAR SFX in command line: Winrar SFX command line ignoring -iicon switch
Rar a -r -ep1 -sfx -iiconC: \ AMC \ setupicons \ setup.ico -z "Source \ createrarsetups.conf" setup.exe "SetupFiles \ *"
"% ProgramFiles% \ WinRAR \ WinRAR.exe" a -r -ep1 -inul -ibck -y -sfx -iiconC: \ AMC \ setupicons \ setup.ico -z "Source \ createrarsetups.conf" setup.exe "SetupFiles \ * "
If errorlevel 1 echo there was an error on creating the SFX archive!
Rar a -r -ep1 -sfx -z "Source \ createrarsetups.conf" setup.exe "SetupFiles \ *"
Winrar s-iiconC: \ AMC \ setupicons \ setup.ico setup.exe
Another machine to use WinRAR SFX manuly: how to cut the resources under the Debug folder into an EXE file directly