There is an excel file that contains paths for several scripts. I am using os.system(command)
in a for loop. At each iteration, the path is read from the excel file and runs a script for that path.
My problem is that every time using os.system()
, CMD opens, execute one command and close it. In the next iteration, the second path is read again and executed, and the CMD is closed. Here the CMD pops up again and again. And the system is busy during this period and cannot perform another task. I want to execute all the commands (scripts) in one CMD, because I would like to minimize it and use the system for other tasks.
At each iteration, there are two main steps:
os.chdir(PATH)
os.system(path of exe+" "+name of config file that is present at PATH")
Can this be done using a subprocess. If yes, please give me an example of how this can be implemented?
source share