I have a python script and would like to open CMD and run another exe app after finishing with python script.. I have been trying to use os system and subprocess and read the forum, however can not find how to run another .exe app in the cmd I got the following rror: command is not recognized as an internal or external command operable ... I attached the script:
import numpy as np
import os
import subprocess
import sys
L_b = int(input("PLEASE ENTER LENGTH OF BEAM: "))
xf = L_b+3
print(xf)
p = subprocess.Popen(["cmd", "NAMEOFAPP.exe",shell = True)
#p = subprocess.call(["NAMEOFAPP"], shell = True)
#os.system("start /B start NAMEOFAPP.exe @cmd /k {NAMEOFAPP.exe}")
Try this:
import os
os.chdir("C:/path/to/the/file") ## Do this if you're not currently in the directory that contains the .exe file
os.system("start NAMEOFAPP.exe") ## This command runs the app
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.