C# Run CMD as Administrator
<p>I'm trying to run cmd command as administrator. But the CMD window closes unexpectedly. If CMD window stays I can see the error. I tried to use <code>process.WaitForExit();</code></p>

<p>I am trying to run the code <code>zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk</code> as administrator. </p>

<p>Here is my code.</p>

<pre><code>        //The command that we want to run
        string subCommand = zipAlignPath + " -v 4 ";

        //The arguments to the command that we want to run
        string subCommandArgs = apkPath + " release_aligned.apk";

        //I am wrapping everything in a CMD /K command so that I can see the output and so that it stays up after executing
        //Note: arguments in the sub command need to have their backslashes escaped which is taken care of below
        string subCommandFinal = @"cmd /K \""" + subCommand.Replace(@"\", @"\\") + " " + subCommandArgs.Replace(@"\", @"\\") + @"\""";

        //Run the runas command directly
        ProcessStartInfo procStartInfo = new ProcessStartInfo("runas.exe");

        //Create our arguments
        string finalArgs = @"/env /user:Administrator """ + subCommandFinal + @"""";
        procStartInfo.Arguments = finalArgs;

        //command contains the command to be executed in cmd
        using (System.Diagnostics.Process proc = new System.Diagnostics.Process())
        {
            proc.StartInfo = procStartInfo;
            proc.Start();

        }
</code></pre>

<p>Is there a way to keep the CMD window running/showing?</p>