2016-04-29 115 views
0

我正在从运行可执行文件的代码后面运行命令行参数。问题是可执行文件应该从二进制文件中创建一个csv文件,它可以正常工作,除非我需要在该过程完成时移动该文件。我的问题是如何知道过程何时完成。任何想法将不胜感激。如何等待,直到System.Diagnostics.Process.Start完成

System.Diagnostics.Process.Start(hexFilePath, filepath + " B");//This creates csv 

这里需要有某种机制等待进程结束。

File.Move(filepath, archiveDirectory);//This is where i move the binary file to archive 

回答

2
var p = Process.Start((hexFilePath, filepath +" B");//This creates csv 
p.WaitForExit(); 
+0

没错奏效感谢这么多。 – Maxqueue

+0

将在8分钟内验证 – Maxqueue