-1

これは簡単な質問かもしれません...exeファイルを抽出または解凍しようとしています。winzip を手動で使用して exe ファイルを解凍しようとしましたが、プログラムで.mst, .cam, .exe files in a folder cache-2012.1.2.702-win_x64c# を使用してこれを実行したい多くのファイルが抽出されました。

このサンプル コードは、次のリンクから取得しました: http://dotnetzip.codeplex.com/wikipage?title=CS-Examples&referringTitle=Examples

誰でもexeファイルを抽出または解凍するコードを提供できますか?抽出cache_x86.msiしたファイルから特定のexe()ファイルを起動したいのですが。

以下はzipファイルを作成し、.exeファイルを抽出していません。

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);
            }
4

2 に答える 2

2

7zip.exe コンソール アプリの使用を提案します。Process クラスを使用して開始できます。

[編集]

チュートリアルは次のとおりです: http://www.dotnetperls.com/7-zip-examples

于 2012-07-26T07:28:31.253 に答える
1
    output = StartProcessing("MySelfExtractExeFile.exe", " /auto " + sOutputFilePath);

    private string StartProcessing(string sProcessingFile, string Arguments)
    {
        try
        {
            Process p = new Process();
            p.StartInfo.FileName = sProcessingFile;// "cmd.exe";
            p.StartInfo.Arguments = Arguments;// " /auto " + sOutputFilePath;

            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.UseShellExecute = false;
            //make the window Hidden 
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            p.Start();
            string output = p.StandardOutput.ReadToEnd();
            p.WaitForExit();
            return output;
        }
        catch (Exception ex)
        {

            return ex            
        }
    }
于 2013-02-18T06:07:58.643 に答える