Self-extracting mode of WinRAR-imsoft.cnblogs

Source: Internet
Author: User

One SFX( self-extractingA self-extracting file is a compressed file, which combines an executable module with a module that runs an extract file from a compressed file. Such a compressed file does not require an external program to decompress the contents of the self-extracting file, and it can run the operation itself. However, WinRAR can still treat self-extracting files as any other compressed file. So if you don't want to run the self-extracting file you received (for example, it might contain a virus), you can use WinRAR to view or unzip its contents.

A self-extracting file usually has an. exe extension, just like any other executable file.

Self-extracting files are handy if you want to compress files to someone, but don't know if they have the compression program to unzip the file. You can also use self-extracting to publish your own software, such as the WinRAR installation program is made using the graphical GUI RAR self-extracting module default.sfx .

To create a self-extracting file from the command line, you can use the-SFX switch to make a new compressed file, or S to convert an existing compressed file into a self-extracting file. In the WinRAR graphical interface There are two ways, one is when you want to create a new compressed file, choose the "Create self-extracting file" option from the zip file name and Parameters dialog box, the other is to enter the existing compressed file and click the "Self-extracting" button.

The WinRAR contains several self-extracting modules, all of which have an. sfx extension and must be placed in the same folder as the WinRAR. The default WinRAR always uses the Default.sfx module, but you can also specify other module names directly with the "-SFX" switch or the "S" command. For example, convert Myarchive.rar into a self-extracting format and run using the wincon.sfx module:

WinRAR Swincon.sfx Myarchive.rar

In the WinRAR graphical interface, you can select the self-extracting module you want to use in the menu, and it will appear when you run the "Convert to self-extracting file" command.

㈠, graphical interface RAR and ZIP self-extracting modules (DEFAULT.SFX and ZIP.SFX)

With these two modules you can create a GUI (graphics mode) self-extracting file of 32-bit Windows (Windows 95,98,NT, etc.) that cannot be run under Windows 3.1 or DOS. Use the default.sfx module in the RAR Archive and Zip.sfx to zip compressed files.

The self-extracting module contains Windows resources that are allowed to be modified to what you need to look like. For example, you can display the bitmap you want in the Start dialog box. WinRAR does not provide tools or documentation to modify resources. This is a complicated process, and if you do, you have to have the resource editor and know how to use them. But if the standard self-extracting dialog box satisfies you, you don't need to modify the resources.

The self-extracting module contains Windows resources that are allowed to be modified to what you need to look like. For example, you can display the bitmap you want in the Start dialog box. WinRAR does not provide tools or documentation to modify resources. This is a complicated process, and if you do, you have to have the resource editor and know how to use them. But if the standard self-extracting dialog box satisfies you, you don't need to modify the resources. If you just want to change the self-extracting bitmap or icon, you can use the "text and icons" in the advanced Self-extracting Options dialog box.

Description: WinRAR is created by default as a RAR self-extracting file, so you can only see the RAR self-extracting module in the module. If you want to create a zip self-extracting file, you will need to select Zip in the compressed file format. Then, you can see the ZIP self-extracting module in the module.

1, graphical interface self-extracting module: command line Options

Options Description-d< path > Set the destination path for the extracted files. -p< password > Specify the password for the encrypted self-extracting compressed file.

-S,-S1,-S2

Silent mode. Switch-S is a concise form of-s1. -S and-s1 both hide the SFX dialog box and the process of pressing. -s2 hides the Startup dialog box, but displays the decompression process. -sp<par> defines parameters that are passed to the application specified in the Setup command.

2, graphical interface self-extracting module: Installation Command (self-extracting script command)

Setup

Command Command

Grammar

Narrative

Delete delete=< file name > Remove files before extracting License license=< License Agreement dialog box title > Display program's License Agreement Overwrite overwrite=[n] Select file overwrite mode Path Pa Th set Default destination path Presetup presetup=< Program > Specify program to run before decompression Savepath Savepath storage target path Setup setup=< program > Specify program to run after decompression Shortcut SH ortcut=< target type >,< Source name >,< destination Folder >,< description >,< Shortcut name > Create Shortcut to extract file Silent silent[= parameter] Skip Start dialog box Tempmode tempmode=[problem Narration][@ window title text] Extract compressed file to Temp folder text text=< string > Add text to Self-extracting dialog box text window title title=< title > Set Self-extracting dialog box title

3, advanced Self-extracting Options dialog box

The dialog box can be started by converting a compressed file into a self-extracting format command and clicking the Advanced Self-extracting options button. It allows you to specify parameters for self-extracting compressed files, such as the default target path, window title, and text. It will automatically generate scripts using the self-extracting script commands described in the Windows self-extracting module specialized topic. So you don't have to learn the scripting language and enter your own commands, just set the options you want.

Note that these self-extracting parameters can only be applied to the Windows graphics interface module, not to console or non-Windows self-extracting programs.

The self-extracting parameters of this dialog box are combined into a sub-dialog box, described below:

⑴, self-extracting option: General

Decompression path

Sets the default destination path to extract files. You can choose to create it in the user's "program Files" folder, or the current folder, or specify an absolute path here. The first two cases do not require a "\" backslash character that contains a drive letter or prefix, and the third must have one.

The corresponding self-extracting script command-Path

path=< path >

Sets the default destination path. The absolute use starting point of the path is the < drive letter without changing it;: If < path > contains only the name, it will be appended to the program Files folder, and if you wish to turn off this effect, from the ". \" The character starts to define start < path >.

Example:

A) Set "Calc 3.05 beta" as the folder name, located under "program Files" as the default path:

Path=calc 3.05 Beta

b) Set "C:\Calc" as the default path:

Path=c:\calc

c) Set "Calc" as the default path in the root directory:

Path=.\calc

Unzip path/save and restore Path

This option allows the self-extracting program to store the user-entered target path in the registry and restore the same decompression path the next time the self-extracting file runs. The original path value is placed in the list drop-down menu of the input destination path area, so the user can select from the previously entered and original paths.

This feature can be handy when installing a new version or updating some software to the same directory. It allows you to change the target path only once, without having to enter it every time.

This can only be used in a combo box that is not empty for the decompression path area.

Corresponding SFX script commands-Savepath

Savepath

This command allows the self-extracting program to store the user-entered target path in the registry and restore the same path the next time the self-extracting file is run. The original path command content is placed in the list drop-down menu of the input destination path area, so the user can select from the previously entered and original paths.

This feature can be handy when installing a new version or updating some software to the same directory. It allows you to change the target path only once, without having to enter it every time.

The savepath command can only be used once with the Path command.

Example:

Path=calc 3.05

Savepath

Install program/unzip and run

After successful decompression, the self-extracting program will try to run the specified program. The folder containing the extracted files will be set to the current folder before running the program. If the program name contains spaces, it must use quotation marks.

The corresponding self-extracting script command-Setup

setup=< Program >

After a successful decompression, self-extracting will try to run < program >. Before running < program > , the folder containing the extracted files will be set to the current folder

Example:

Setup=setup.exe

Attention

1) If you are having problems with self-extracting running InstallShield Setup.exe , try running "setup.exe/sms" instead of the concise "Setup.exe". This switch allows self-extracting to detect the exit of the installer.

2) You can use the-sp< parameter > self-extracting command line switch to pass optional parameters to the setup=< program > commands specified by the program.

3) Self-extracting module set the sfxname and sfxcmd environment variables before starting the Setup program. The sfxname variable contains the name of the self-extracting module, and thesfxcmd variable contains the complete command line received by the self-extracting module. So the installer can read this information when it is needed. The installer can read the information if it needs it.

Install program/run before decompression

The self-extracting program tries to run the specified program before starting the decompression, and the target directory is set to the current folder before running the program. If the program name contains spaces, it must use quotation marks. For example, when installing a new version to overwrite an older version, you can specify the command when you want to remove the old version of the program.

The corresponding self-extracting script command-Presetup

presetup=< Program >

Self-extracting before unzipping will try to run < program >, before running < program > You must first specify the target folder . You can use this command, for example, to remove the previous version of the program when installing the new version on the old version. If the program name contains spaces, it must be enclosed within quotation marks.

Example:

Presetup=uninstall.exe/clean

Save current settings as default values

Saves all and current settings that are made in the advanced Self-extracting Options dialog box, and treats them as default values each time you create a self-extracting compressed file.

⑵, self-extracting option: Advanced

-Files to be deleted in the destination folder

Before extracting, the self-extracting program tries to delete the specified files or files within the target folder. You can enter more than one file here, and to do so, the filenames must be separated by a space.

If the file specified here is locked and cannot be deleted, the self-extracting module will try to temporarily rename it before extracting it and remove it when Windows restarts, depending on the version of Windows.

The corresponding self-extracting script command-Delete

delete=< file name >

Deletes the specified file before extracting it to the destination folder, allowing several delete commands.

If the file specified here is locked and cannot be deleted, the self-extracting module will try to temporarily rename it before extracting it and remove it when Windows restarts, depending on the version of Windows.

Example:

Delete=winrar95.exe

Delete=rarlng.dll

-Shortcuts

Allows you to create a shortcut to the compressed file after decompression. Press the Add Shortcut button to describe a new shortcut. The shortcut parameters that have been entered are stored under the same list as the shortcut script command format. If you want, you can edit it manually.

The corresponding self-extracting script command-Shortcut

shortcut=< target type >,< Source name >,< destination Folder >,< description >,< shortcut name >

A shortcut is common to the extracted files.

The target type is an area of one character justifies and can have the following values:

D Create shortcut in Desktop S in Start menu Create Shortcut P in Start menu/program create Shortcut T in Start menu Create Shortcut

The source name is a compressed file name.

The destination folder is the folder that creates the shortcut, and if it does not exist, it is created by the self-extracting file.

Description is a string that describes the shortcut.

The shortcut name is the file name of the. lnk (shortcut) file created by the self-extracting.

All parameters are separated by commas. If you need to add a comma character within the parameter, insert the entire parameter reference. If you need to insert a reference mark in the string, enter two quotation marks. Only the target type and Source name are required, and other parameters are optional.

Example

In the desktop, create a shortcut to connect to Winrar.exe in the WinRAR folder, with the description of "WinRAR executable" and the name of the WinRAR compressed file Manager:

Shortcut=d,winrar.exe,winrar, "WinRAR executable file", "WinRAR compressed File Manager"

⑶, self-extracting option: Mode

-Temp mode/Unzip files to Temp folder

This option forces the self-extracting program to create a temporary folder, then unzip all the files into this folder, start running the program specified in the run area after Setup/decompression , and delete all contents of the Temp folder after Setup is complete. When these operations are run, the self-extracting program is automatically set to silent mode (described below). If you set the extract compressed files to Temp folder, you can also specify the installer and do not use the decompression path area. You can also set up two optional string parameters that define the title of the problem before and after the problem is suppressed. Examples of this type will only begin extracting when the user chooses the "Yes" button.

The corresponding self-extracting script command-Tempmode

tempmode=[problem Narrative][@ window title text]

This command forces self-extracting to create a temporary directory, unzip all the files to this point, and then start running the program specified by the Setup command and clear all the contents of the temporary directory after the Setup program is complete. When these operations are run, self-extracting is automatically set to silent mode. If the tempmode command exists, there will be a Setup command in the narrative and no path command.

The tempmode command can have options for string parameters that are available before unzipping to define the problem and the title of the problem. In this case, the decompression will only begin when the user chooses the "Yes" button.

Example:

A) Tempmode

b) tempmode= do you want to continue installing Calculator 3.05? Calculator installation program

-Silent mode

The default self-extracting will ask for confirmation before starting to unzip and allow the user to change the destination folder. If you set " silent mode " to " hide the Startup dialog ", you will skip the confirmation screen. If you also want to hide the decompression process, select Hide All .

The corresponding self-extracting script command-Silent

silent[= parameters]

The Start dialog box does not appear when the decompression begins.

The parameter can be either 1 or 2. If the parameter is 1, the Start Decompression dialog box is completely hidden, containing the process indication and file name. If the parameter is ignored or 2, the confirmation to start the decompression is skipped, but the user can still see the decompression process of the compressed file.

Example:

silent=2

-Overlay Mode

Here you can choose to let the self-extracting program how to manipulate your existing files: Overwrite before asking (default), always overwrite or skip forever.

The corresponding self-extracting script command-Overwrite

Overwrite=[n]

If [n] is 0, the user will be asked before overwriting the file. This is the default action of the override command, which can be specified without the need. If [n] does not exist or equals [1], the file will be overwritten without confirmation. if [n] equals [2], all existing files will not be overwritten.

Example:

Overwrite=1

⑷, self-extracting options: Text and icons

-Self-extracting window title

Sets the specified text as the caption of the self-extracting window.

The corresponding self-extracting script command-Title

title=< title >

Sets the self-extracting window caption.

Example:

Title==calculator, version 3.05

-Self-extracting window displays the text

Adds a plain text or HTML string specified in the Text Output window of the self-extracting module.

For plain text, the self-extracting module merges and re-formats the specified string in order for the string to match the dialog box. So if you want to regenerate a new paragraph, you need to put an empty string in front of it.

You can use HTML to control the color, font, and format of the display. The description of HTML syntax can be found at the world Wide Web Consortium site. You can also use a Web page editing program to generate HTML text.

The corresponding self-extracting script command-Text

This command supports two versions of syntax:

A

text=< string >

b

Text

{

String 1

String 2

...

}

It adds the specified plain text or HTML string to the Output window of the self-extracting module. When the self-extracting module encounters the Text command for the first time, it resets the default content of this window before adding < string >. Subsequent commands append < string > to the already existing text.

Depending on the syntax used, this command can add one or several strings at a time.

For plain text, the self-extracting module merges and re-formats the specified string in order for the string to match the dialog box. So if you want to re-create a new paragraph, you need to put an empty string in front of it.

You can use HTML to control the color, font, and format of the display. The description of HTML syntax can be found at the world Wide Web Consortium site. You can also use a Web page editing program to generate HTML text.

If the text consists of several strings, the self-extracting module takes the '} ' character as the end tag of the text, so you should not use this character at the first position of the string in your text. If you need to use the '} ' character at the beginning of the string, insert a space in front of it.

Example:

A) Add a single string to the dialog box window

Text=, this is my new program.

b) Add the specified text to the dialog window "text

{

The most interesting features of this program are:

-Support for Windows clipboard;

-The maximum file size for each processing is 10KB;

}

Load this document from a file

Loads the contents of the selection file as a sub-decompression window text.

Loading a self-extracting picture from a file

Refers to a map image (*.bmp) file used to create or update a self-extracting compressed file.

-Load self-extracting file icon from file

Replace the icon that contains the default self-extracting file with the destination. ico file. This file must contain at least one 32x32 icon, 16 or 256 colors (or all) icons. It is recommended that you do not include 16x16 icons. Icons larger than 32x32 and colors more than 256 colors are only supported by NT-based Windows (NT, $, XP, 2003, etc.), Windows 95, 98, and Me are not supported. If you want to use a large icon size and compression depth, then you cannot compress the self-extracting module with any third-party executable file compression program.

⑸, self-extracting option: License

-License Window Title

Sets the specified text as the License window caption.

-License Text

Displays the text specified as a software license agreement when the self-extracting file is run. The user can accept it and continue to unzip or reject it and exit.

The license text can contain HTML or plain text formatting. In subsequent processing, the self-extracting module merges and re-formats the specified string in order for the string to match the dialog box. So if you want to regenerate a new paragraph, you need to put an empty string in front of it.

You can use HTML tags to control the color, font, and format of the display. The description of HTML syntax can be found at the world Wide Web Consortium site. You can also use a Web page editing program to generate HTML text.

The corresponding self-extracting script command-License

license=< License Agreement dialog box title >

{

License Agreement Text 1

License Agreement Text 2

...

}

Displays the specified as the Software License Agreement text when the self-extracting file is run. The user can either accept it and continue to unzip or reject it and exit.

The license can contain HTML or plain text formatting. In subsequent processing, the self-extracting module merges and re-formats the specified string in order for the string to match the dialog box. So if you want to re-create a new paragraph, you need to put an empty string in front of it.

You can use HTML to control the color, font, and format of the display. The description of HTML syntax can be found at the world Wide Web Consortium site. You can also use a Web page editing program to generate HTML text.

If the text consists of several strings, the self-extracting module takes the '} ' character as the end tag of the text, so you should not use this character at the first position of the string in your text. If you need to use the '} ' character at the beginning of the string, insert a space in front of it.

Example:

license= End User License Agreement

{

All copyrights to RAR belong to the author's proprietary.

This program is shareware and can be used by anyone for a period of testing.

After the test period, you "must" register.

Load this document from a file

Loads the contents of the selection file as the license text.

⑹, self-extracting option: module

Allows the selection of self-extracting modules. Note Not all modules support advanced self-extracting options. It is supported only by the graphical interface rar and ZIP modules (DEFAULT.SFX and ZIP.SFX) , not by the console rar module (WINCON.SFX) and the DOS rar self-extracting module (do S.SFX) support.

4. Convert compressed files to self-extracting format

This command is used when WinRAR is used in file management and in compressed file management mode. It will convert the compressed file into self-extracting. If you are inside a compressed file, you do not need to select any files to run the command, just use the Tools menu, the "self-extracting File" button on the toolbar, or the keyboard shortcut alt+x run the "Convert compressed files to self-extracting format" command and select the desired self-extracting module from the list. If you browse files that are not compressed in file management mode, first select the files and folders that you want to search to convert.

If compression is already a self-extracting file, using this command allows you to remove the existing self-extracting compression module from the compressed file. In this case, WinRAR will not change the original compressed file, only create the same content, but no self-extracting module of the new compressed file.

If you selected the Windows graphical interface self-extracting module, there are some recommended defaults, you can also click the "Advanced self-extracting Options" button to set the self-extracting parameter settings such as default target path, title and window text. Read the advanced self-extracting options topic to get more information about them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.