参考https://www.programcreek.com/python/example/97304/win32com.shell.shell.ShellExecuteEx
import win32api
import win32event
import win32process
import win32con
import os
from win32com.shell.shell import ShellExecuteEx
from win32com.shell import shellcon
PATH_380B_PRJ = r"..\..\..\xxx.atomprj"
def Callexe():
abspath = os.getcwd()
prjpath = os.path.join(abspath, str(PATH_380B_PRJ))
exePath = r"C:\123.exe"
param = str(prjpath) + r" -guicmd rebuild -compileroption release -exit"
#win32api.ShellExecute(0,"open",exePath,param,'',1)
process_info = ShellExecuteEx(nShow=win32con.SW_HIDE,
fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
lpVerb='runas',
lpFile=exePath,
lpParameters=param)
win32event.WaitForSingleObject(process_info['hProcess'], 600000)
ret = win32process.GetExitCodeProcess(process_info['hProcess'])
win32api.CloseHandle(process_info['hProcess'])
#handle = win32process.CreateProcess(exePath, param, None, None, 0, win32process.CREATE_NO_WINDOW, None, None, win32process.STARTUPINFO())
print("end")
win32event.WaitForSingleObject(handle[0], -1)
#encoding=utf-8
import subprocess
sh=r'F:\program files\SHplayer\5.0.2.34\SHPlayer.exe'#这里r可以可以不管空格和中文字符的烦恼
avi=r’F:test.avi’
runavi=subprocess.Popen(sh+' '+avi)
---------------------
作者:jirryzhang
来源:优快云
原文:https://blog.youkuaiyun.com/jirryzhang/article/details/52791883
版权声明:本文为博主原创文章,转载请附上博文链接!
win32api.ShellExecute(0, "open", 'bintobin.exe', 'defaultGroup.bin', '', 1)
win32api.ShellExecute(0, "open", 'softbuilder_new.exe', str(hwxToolName) + '_hwx.cfg', '', 1)
subp = subprocess.Popen(binPath + '\\softbuilder_new.exe' + ' ' + str(hwxToolName) + '_hwx.cfg', shell=False)