PostExtractCommandLine Property

DotNetZip

Ionic Zip Library v1.9.1.6 PostExtractCommandLine Property
ReferenceIonic.ZipSelfExtractorSaveOptionsPostExtractCommandLine
The command to run after extraction.
Declaration Syntax
C# Visual Basic Visual C++
public string PostExtractCommandLine { get; set; }
Public Property PostExtractCommandLine As String
	Get
	Set
public:
property String^ PostExtractCommandLine {
	String^ get ();
	void set (String^ value);
}
Remarks

This is optional. Leave it empty (null in C# or Nothing in VB) to run no command after extraction.

If it is non-empty, the SFX will execute the command specified in this string on the user's machine, and using the extract directory as the working directory for the process, after unpacking the archive. The program to execute can include a path, if you like. If you want to execute a program that accepts arguments, specify the program name, followed by a space, and then the arguments for the program, each separated by a space, just as you would on a normal command line. Example: program.exe arg1 arg2. The string prior to the first space will be taken as the program name, and the string following the first space specifies the arguments to the program.

If you want to execute a program that has a space in the name or path of the file, surround the program name in double-quotes. The first character of the command line should be a double-quote character, and there must be a matching double-quote following the end of the program file name. Any optional arguments to the program follow that, separated by spaces. Example: "c:\project files\program name.exe" arg1 arg2.

If the flavor of the SFX is SelfExtractorFlavor.ConsoleApplication, then the SFX starts a new process, using this string as the post-extract command line. The SFX waits for the process to exit. The exit code of the post-extract command line is returned as the exit code of the command-line self-extractor exe. A non-zero exit code is typically used to indicated a failure by the program. In the case of an SFX, a non-zero exit code may indicate a failure during extraction, OR, it may indicate a failure of the run-after-extract program if specified, OR, it may indicate the run-after-extract program could not be fuond. There is no way to distinguish these conditions from the calling shell, aside from parsing the output of the SFX. If you have Quiet set to true, you may not see error messages, if a problem occurs.

If the flavor of the SFX is SelfExtractorFlavor.WinFormsApplication, then the SFX starts a new process, using this string as the post-extract command line, and using the extract directory as the working directory for the process. The SFX does not wait for the command to complete, and does not check the exit code of the program. If the run-after-extract program cannot be fuond, a message box is displayed indicating that fact.

You can specify environment variables within this string, with a format like %NAME%. The value of these variables will be expanded at the time the SFX is run. Example: %WINDIR%\system32\xcopy.exe may expand at runtime to c:\Windows\System32\xcopy.exe.

By combining this with the RemoveUnpackedFilesAfterExecute flag, you can create an SFX that extracts itself, runs a file that was extracted, then deletes all the files that were extracted. If you want it to run "invisibly" then set Flavor to SelfExtractorFlavor.ConsoleApplication, and set Quiet to true. The user running such an EXE will see a console window appear, then disappear quickly. You may also want to specify the default extract location, with DefaultExtractDirectory.

If you set Flavor to SelfExtractorFlavor.WinFormsApplication, and set Quiet to true, then a GUI with progressbars is displayed, but it is "non-interactive" - it accepts no input from the user. Instead the SFX just automatically unpacks and exits.

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)