Extract a list of the names of a rar file by means of c #

0

Good morning,

I am trying to extract the list of files that contains a .rar file, I have searched for several solutions and I can not find how to do it from c #, the only option that was found was by means of a console using the following code.

    {
        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.EnableRaisingEvents = false;
        proc.StartInfo.FileName = "cmd";
        proc.StartInfo.RedirectStandardInput = true;
        proc.StartInfo.RedirectStandardOutput = true;
        //proc.StartInfo.CreateNoWindow = true;
        proc.StartInfo.UseShellExecute = false; 
        proc.Start();
        proc.StandardInput.WriteLine(@"rar l E:\test.rar >> E:\test.csv");
        proc.StandardInput.Flush();
        //proc.StandardInput.Close();
        proc.Close(); 
    }

The line "rar l E: \ test.rar> > E: \ test.csv" works correctly in the console, before using it, copy the rar.exe file that is generated when installing winrar on my machine, in the System32 folder.

The code generates the following error when executing it from C #.

I need help please.

    
asked by Angel Lopez 31.01.2018 в 16:22
source

1 answer

0

There is a library called sharpcompress, you can find it at GitHub

It has several functions and it is possible to facilitate the task without having to use the CMD

    
answered by 31.01.2018 / 18:32
source