Comment extraire un fichier rar en C#?

Je veux extraire .rar fichiers en utilisant cmd shell j'ai donc écrit ce code:

string commandLine = @"c:\progra~1\winrar\winrar e  c:\download\TestedU.rar c:\download";
ProcessStartInfo PSI = new ProcessStartInfo("cmd.exe");
PSI.RedirectStandardInput = true;
PSI.RedirectStandardOutput = true;
PSI.RedirectStandardError = true;
PSI.UseShellExecute = false;
Process p = Process.Start(PSI);
StreamWriter SW = p.StandardInput;
StreamReader SR = p.StandardOutput;
SW.WriteLine(commandLine);
SW.Close(); 

La première fois, il a bien fonctionné, la deuxième fois il affiche rien.

Serait une powershell ou cmd script pas plus approprié? Est-il une raison particulière vous voulez le faire dans le code?
Voir aussi stackoverflow.com/questions/11737/...
Le Chilkat bibliothèque référencé ci-dessus fonctionne un régal. Seulement l'irritation, c'est que son code non managé.

OriginalL'auteur Hanad | 2010-07-13