Home > other >  Use one .py to start multiple .exe in another directory
Use one .py to start multiple .exe in another directory

Time:10-10

On my desktop I have a run.py that I want to use to start all the start.exe's in folder/folderX/..

-Desktop

 -run.py

 -folder
  -folder1/start.exe
  -folder2/start.exe

I tried this in run.py:

import subprocess

subprocess.call(['.../Desktop/folder/folder1/start.exe', 'arg'], cwd='.../Desktop/folder/folder1')
subprocess.call(['.../Desktop/folder/folder2/start.exe', 'arg'], cwd='.../Desktop/folder/folder2')

The problem is that only one .exe is starting and this in the same window and not in a new one. I want to start them all in new cmds by using a single run.py file.

CodePudding user response:

You problem is you are starting a new subprocess that is the executable you want to run. Don't do that. Start a new cmd.exe and give it the argument of the exe you want to run. There are some command line options you can give to cmd to get what you want but I don't remember them and gave up on Windoze years ago.

Here are some hints: https://sourcedaddy.com/windows-7/cmd-options.html

  • Related