如何在Windows中使用Python创建exe启动器
我想用一个Python脚本来启动一个exe程序,同时也希望用同一个脚本把它结束掉。
一个开始的想法是:
process = magicCommand( 'theExe.exe' ) #invoke exe
kill = 'no'
while kill == 'no':
kill = raw_input()
otherMagicCommand( process ) #kill
编辑
这个方法在Windows上对我有效。
process = subprocess.Popen( 'theExe.exe' ) #invoke exe
kill = 'no'
while kill == 'no':
kill = raw_input()
process.kill() #kill