比如,我需要在C#中调用CMD.EXE,当然这是会出现DOS窗口,我现在怎么在C#中,用代码向这个打开的DOS窗口输入内容?谢谢!

解决方案 »

  1.   

    Process p=new Process;
    p.start("cmd.exe e:\123.exe");
      

  2.   

    我这样用出错。
    Process p = new Process();
    p.StartInfo.FileName = "sn.exe";
    p.StartInfo.Arguments = "-i MyApp.pfx MyApp";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardInput = true;
    p.Start();
    p.WaitForExit();
    p.Close();
    输出为:
    Microsoft (R) .NET Framework Strong Name Utility  Version 2.0.50727.42
    Copyright (c) Microsoft Corporation.  All rights reserved.Enter the password for the PKCS#12 key file: Failed to parse the PKCS#12 blob in
     MyApp.pfx -- 句柄无效。
    请按任意键继续. . .