Mik*_*ika 15 c# shell command prompt output
我正在执行命令提示符命令,如下所示:
string cmd = "/c dir" ;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = cmd;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
Run Code Online (Sandbox Code Playgroud)
如何获取命令的输出?
Sac*_*hin 19
试试这个
string output = proc.StandardOutput.ReadToEnd();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27348 次 |
| 最近记录: |