• Syntax 1:
    -sfx -template
  • Syntax 2:
    -sfx archive {options}



This command allows to create a self-extracting archive from an existing ZIP archive. This command has a wide set of options that are the same you can find in the SFX wizard of ZipGenius.
The first syntax of this command writes a template options file on the desktop, so you can easily modify that upon your requirements and use it through the "@" parameter (as explained below); on the contrary, the second syntax is the true command line syntax where you can directly specify which options should be used while converting the ZIP file to EXE.

An option file is a plain text file (with .SOF extension) that contains the following settings: it is useful when you need often to convert a ZIP file to EXE, because you can reuse it at anytime you need.

.SOF options file parameters

  • Title
  • the title of your SFX, it will appear on top of its window
  • MsgType
  • Type of message you want to show when your SFX is launched (see below).
    0 - simple message (only "OK" button)
  • 1 - information ("OK" and "Cancel" buttons)
  • 2 - confirmation (Yes" and "No" buttons)
  • MsgText 
  • Text of the message you may want to show upon SFX startup. Leave blank if you don't want any message to appear.
  • Autorun
  • 0 - FALSE: no file is automatically launched after extraction
    1 - TRUE: file autorun enabled, see also RunFile and AskAutorun.
  • RunFile
  • This setting lets specify the full path of the file that the SFX should run after extraction. Example: RunFile="\Test\Testfile.exe", or: RunFile = "Setup.exe". If you want to run a file that has been stored with path information, the path must be specified as you can see in the first example. It is suggested to write paths between quotes (").
  • AskAutorun
  • 0 - FALSE: the end user won't be allowed to disable the autorun of a file
    1 - VERO: a checkbox in the SFX dialog will allow the end user to disable the autorun of a file
  • DestPath
  • Write here the default destination path where files in the archive should be extracted to. Further details on destination path: Creating a self-extracting archive.
  • DestSubPath
  • If you want, you can create a subfolder in the destination path: write here the name of the subfolder. Firther details: Creating a self-extracting-archive.
  • OvrType
  • This option sets program behaviour with files that already exists in the destination path:
    0 - ask user
    1 - always overwrite existing files
    2 - skip file
  • HideOvrBox
  • This option allows to hide the overwrite behaviour selector from the SFX dialogs:
  • 0 - FALSE: overwrite mode selector will appear
    1 - TRUE: overwrite mode selectore will be hidden
  • SelectFile
  • This option allows end-user to select files to extract from the SFX archive:
    0 - FALSE: end-user won't be allowed to select files
    1 - TRUE: end-user will be allowed to select files
  • ShowSuccessMsg
  • This option can force the SFX archive to show a "success message" after files extraction:
    0 - FALSE: no message will appear after extraction
    1 - TRUE: the success message will appear
  • ExpandEnvVars
  • This option will force the SFX to translate environment variables in "%...%" form written in the destination path (DestPath):
    0 - FALSE: variables won't be translated
    1 - TRUE: variables will be translated (recommended)
  • HideFileList
  • This option will force the SFX to hide/show the file list:
    0 - files list will be visible
    1 - files list will be initially hidden (end-user will have to click on "Show files" to see it)
    2 - files list will be hidden
  • AllowCancel
  • This option will allow end-user to abort files extraction:
    0 - FALSE: end-user won't be allowed to cancel extraction
    1 - TRUE: end-user will be allowed to cancel extraction
  • Icon
  • If you want to customize the main icon of your SFX archive, you can specify here the path to an .ICO (icon) file. Remember to write this path between quotes ("). If you leave this field blank, the SFX archive will show its default icon.

The alternate way to convert a ZIP file to an executable one, is to use the second syntax of -SFX; in this case you can specify more options and you can still use an existing options file (.SOF). The parameters you can specify for -SFX command are similar to those you can specify for -ADD.

W(path)

This parameter lets you specify the .BIN module you want to use to do the conversion. SFX modules (.BIN files) differ for the language used in the dialogs.
It is possible to specify the path to a custom SFX module or you can use one of the .BIN files installed by ZipGenius: you just have to use (or to not use) the # character before the .BIN filename:

  • W#italiano.bin will force the program to use the "italiano.bin" file installed by ZipGenius;
  • Witaliano.bin will set the program to use the "italiano.bin" file that should be placed in our current directory.

If you want to know which .BIN files are available,  use the following parameter (all other switches will be ignored): W?

If the specified .BIN file can't be found, the program will automatically use the english.bin installed by ZipGenius.
 

N(text)

If you want to show a message upon SFX startup, use "N" followed by your message (see example below); if you don't want any message to appear, just omit this parameter. Messages bust be inserted between quotes ("). See also the "M" parameter.

Example:

N"This is a very long message with spaces between. As you can see, it is written between quotes."
 

M[ 0 | 1 | 2 ]

If you have used the "N" parameter to show a message on SFX startup, you can also set which type of message to show by setting one of the following values for "M":

  • 0 - basic message (only "OK" button)
  • 1 - information ("OK" and "CANCEL" buttons)
  • 2 - confirmation ("YES" and "NO" buttons)

The default value is M0 and it will be automatically selected if "M" is not specified. Also, this parameter will have no effect if your command line misses the "N" parameter.
 

T(title)

This parameter lets you specify the title for your SFX dialog. If "T" is not specified, a generic title will appear on top of your SFX dialog.
 

L[ 0 | 1 ]

This parameter will allow end-user of the SFX to select which files to extract.

Possible values for "L" are:

  • 0 - option DISABLED
  • 1 - option ENABLED

If not specified in the command line, the program will automatically set this parameter to L0.
 

B[ 0 | 1 ]

This parameter lets you set the visibility of the overwrite mode selector box in the SFX dialog. The end-user of your SFX won't be allowed to set the behaviour that the SFX must have when it is going to extract files already existing in the destination path.

Possible values of "B" are:

  • 0 - overwrite mode selector HIDDEN
  • 1 - overwrite mode

If not specified, this parameter will be automatically set to B0.
 

O[ 0 | 1 | 2 ]

This parameter lets you set the overwrite mode that SFX must apply when it is going to extract files that already exists in the destination path. If it is used when "B1" is specified, the end-user won't be allowed to modify the overwrite mode.

"O" may assume one of the following values:

  • 0 - ask user
  • 1 - skip file
  • 2 - overwrite file without confirmation

If not specified, this parameter will be automatically set to O0.

 

D(path / registry key)

This parameter lets you specify the default extraction path that will appear in SFX dialog window. The "D" parameter may be followed by a real path name, by a Windows Registry key that returns a path or by an environment variable in the "%...%" form.:

  • Filesystem path
    Ex.: "C:\My Folder\"
  • Windows Registry Key
    Ex.: "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop"
  • Enviroment variable in "%..%" form
    Ex.: "%windir%"

While the first form of path is quite simple to specify, it is just useful when your SFX is going to be used by yourself or by someone whose computer has a path structure that you already know.

On the contrary, if you want to get your files extracted in specific paths that are common to every Windows but that may be "phisically" different, you can use the other two forms. These usually require a good knowledge of Windows® operating systems and its registry structure, but you can still find more details in "Creating a self-extracting archive" section.
 

U(folder name)

This parameter lets you specify the subfolder where your files will get extracted to. The folder will be created in the path specified through the "D" parameter.
 

V[ 0 | 1 ]

This parameter lets you specify whether your SFX archive should expand "%...%" environment variables written in the "D" parameter.

Possible values of "V" are:

  • 0 - option DISABLED (variables won't be expanded)
  • 1 - option ENABLED

Default value of "V" V1 and it will be used if "V" won't be specified.
 

H[ 0 | 1 |  2 ]

This parameter lets you set the SFX files list visible or hidden or just initially hidden.

Possible values of "H" are:

  • 0 - files list visible
  • 1 - files list initially hidden
  • 2 - files list hidden

Default value is H0.
 

A[ 0 | 1 ]

This parameter lets you set the SFX to autorun files extraction without user interaction.

Possible values are:

  • 0 - autorun DISABLED
  • 1 - autorun ENABLED

If not specified in the command line, the program will use the default value (A0).
 

I(.ICO file path)

This parameter lets you specify the path of the custom icon you may want to show in the SFX dialog window. The icon file must be an .ICO file.
 

C(file)

This parameter lets you specify which file must be executed after files extraction.
 

K(command line parameters)

This parameter lets you specify additional parameter to run the file specified in "C". You should used quotes (") to write long command lines.
 

S[ 0 | 1 ]

This parameter lets you set your SFX to show a "success message" after files extraction.

Possible values are:

  • 0 - DO NOT SHOW success message
  • 1 - SHOW success message

Default value is S1.
 

R[ 0 | 1 ]

This parameter lets you set your SFX archive to allow end-user to disable the autorun of a file after extraction (see parameter "C" ).

Possible values are:

  • 0 - opzione DISABLED
  • 1 - opzione ENABLED

Default value is R0.
 

E[ 0 | 1 ]

This parameter lets you allow your SFX end-user to abort extraction.

Possible values of "E" are:

  • 0 - user CANNOT ABORT extraction
  • 1 - user IS ALLOWED to abort extraction

The default value is E1.
 

@(file .SOF)

This parameter tells to the program to load SFX settings from a previously stored .SOF file (a ZipGenius SFX options file). Any other parameter will be ignored in this case.
 


Examples:

1) zg -sfx test.zip
This is the minimum number of parameters required by -sfxtest.zip will be converted to test.exe and just using all the default parameters values.

2) zg -sfx test.zip W#italiano.bin T"This is my archive SFX" S0
Like example (1), but this time we are going to use the italian .BIN file installed by ZipGenius, a message will appear at SFX startup and no message will appear after files extraction.


Created with the Personal Edition of HelpNDoc: Easily create iPhone documentation