How to avoid the Windows (XP) Security Warning when launching a "DOS" command line within C#?

Posted by Will Marcouiller on Stack Overflow See other posts from Stack Overflow or by Will Marcouiller
Published on 2010-06-08T14:57:17Z Indexed on 2010/06/08 15:02 UTC
Read the original article Hit count: 194

This question is related to this initial question asked a little while ago.

Now, that I have chosen the extracting tool, I'm iterating through a given in command line parameter directory and subdirectories to extract the compressed .zip files.

private static void ExtractAll(DirectoryInfo _workingFolder) {
    if(_workingFolder == null) {
        Console.WriteLine("Répertoire inexistant.");
        return;
    }

    foreach (DirectoryInfo subFolder in _workingFolder.GetDirectories("*", SearchOption.AllDirectories)) 
        foreach(FileInfo zippedFile in subFolder.GetFiles("*.zip", SearchOption.AllDirectories)) {
            if(zippedFile.Exists) {
                ProcessStartInfo task = new ProcessStartInfo(@".\Tools\7za.exe", string.Format("x {0}", zippedFile.FullName));
                Process.Start(task);
            }
    }
}

But everytime I start a 7za process, the Windows Security Warning prompts. I would like to avoid such annoying behaviour, so here's my question:

How to avoid the Windows (XP) Security Warning when launching a "DOS" command line within C#?

© Stack Overflow or respective owner

Related posts about c#

Related posts about command-line