This may be a simple question...I'm trying to extract or unzip exe file. I tried to unzip my exe file using winzip manually and it extracted many .mst, .cam, .exe files in a folder cache-2012.1.2.702-win_x64
I want to do this by pro-grammatically using c#.
I got this sample code from this link:http://dotnetzip.codeplex.com/wikipage?title=CS-Examples&referringTitle=Examples
Can anybodey give some code which extracts or unzip the exe file and then I want to launch a particular exe(cache_x86.msi
) file from the extracted files.
The below makes a zip file and it's not extracting the .exe file.
var sfxFileToCreate = @"D:\2012.1.2.702\64\cache-2012.1.2.702-win_x64.exe";
using (var zip = new ZipFile())
{
var filesToAdd = System.IO.Directory.GetFiles(".", "*.cs");
zip.AddFiles(filesToAdd, "");
var sfxOptions = new SelfExtractorSaveOptions
{
Flavor = SelfExtractorFlavor.WinFormsApplication,
Quiet = false,
Copyright = "(c) 2011 Test",
Description = "This is a test",
SfxExeWindowTitle = "My SFX Window title"
};
zip.SaveSelfExtractor(sfxFileToCreate, sfxOptions);
}
I propose to use 7zip.exe console app. You can start it using Process class.
[edit]
Here's the tutorial: http://www.dotnetperls.com/7-zip-examples