gpt4 book ai didi

c# 执行 shell 命令并获取结果

转载 作者:可可西里 更新时间:2023-11-01 07:45:12 25 4
gpt4 key购买 nike

<分区>

我正在执行命令提示符命令,如下所示:

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();

如何获取命令的输出?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com