如何知道命令是在进程中执行的? [英] How to know the command is executed in a process?
本文介绍了如何知道命令是在进程中执行的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经启动了cmd进程并执行了一些命令,我不知道该命令是否正在执行,如何找到它?
I have started the cmd process and executing some commands, i don't know that command is getting executed or not, how to find it out?
推荐答案
看看:如何通过命令行执行命令并等待它完成:
使用Process.WaitForExit 方法:
Take a look: How to execute a command via command-line and wait for it to be done:
Use the Process.WaitForExit Method:
public void runCmd()
{
String command = @"/k java -jar myJava.jar";
ProcessStartInfo cmdsi = new ProcessStartInfo("cmd.exe");
cmdsi.Arguments = command;
Process cmd = Process.Start(cmdsi);
cmd.WaitForExit();
}
.
.
.
runCmd();
MessageBox.Show("This Should popup only when runCmd() finishes");
这篇关于如何知道命令是在进程中执行的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文