Passing Command Line Parameters with ZipSFX
The FileToExecuteParams configuration setting allows you to pass command line parameters to the FileToExecute executable. Simply set the config to a space-separated list of the parameters you wish to pass, like this:
zipsfx.Config("FileToExecuteParams=here are some parameters");
The archive executable itself also supports the '/s' command-line parameter for silent extraction. The SilentExtraction configuration setting can be set to hide any UI interaction during extraction. SilentExtraction can be set like this:
zipsfx.Config("SilentExtraction=true");
The following example creates an archive which combines these two config settings, both extracting silently and passing parameters to an executable upon extraction:
Zipsfx zipsfx = new Zipsfx();
zipsfx.FileToExecute = "echoParams.exe";
zipsfx.ArchiveFile = "archive.exe";
zipsfx.SourceDirectory = sourceFilePath;
zipsfx.ExtractToPath = extractFilePath;
zipsfx.Config("FileToExecuteParams=echo these parameters");
zipsfx.Config("SilentExtraction=true");
zipsfx.CreateSFX();
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.