如何从python运行.exe,等待该.exe完成执行,然后关闭.exe开始执行时打开的命令提示符。因此,基本上,最后,我将尝试关闭早先打开的.exe文件,但仅在其完成执行之后。
//the ReadBowlers method reads the names of bowlers
//into the listBowlers.
private void ReadBowlers(List<Bowler> listBowlers)
{
try
{
//Open the Bowlers.txt file.
string path = @"Bowlers.txt";
//read the names into the list
using (FileStream fs = File.OpenRead(path))
{
byte[] b = new byte[1024];
UTF8Encoding temp = new UTF8Encoding(true);
while (fs.Read(b,0,b.Length) > 0)
{
listBowlers.Add(temp.GetString(b));
}
}
}
catch (Exception ex)
{
//display error message
MessageBox.Show(ex.Message);
}
}
答案 0 :(得分:0)
鉴于您尚未付出努力,金田努力工作,但我认为这是您要尝试的事情;
import sys
sys.exit()