たとえば、コマンド "net user usrname *"にパスワードを入力する3つの手順が含まれています。プロセスがC#でCMD.exeを使用しているときに "Multi-Step"コマンドを実行しました
私のコードを実行している間、追加の引数を送信することが可能であるならば、その後の検証、私は知らない。
Process p = new Process();
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/C " + command;
p.StartInfo.WorkingDirectory = startupFolder;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.UseShellExecute = false;
p.Start();
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
は、標準入力をリダイレクトし、それが文字列養います。 –
RedirectStandardInput = trueでp.StandardInputストリームに文字列を書き込みます – Arthur
このテクニックは試してみます –