I want to run a bat file named Mainfile.bat in location of C:\Users\Administrator\Desktop
Mainfile.bat contents
start cmd /k call C:\Users\Administrator\Desktop\1.bat
start cmd /k call C:\Users\Administrator\Desktop\2.bat
start cmd /k call C:\Users\Administrator\Desktop\3.bat
Once Mainfile.bat started , it should run three bat files specified in the bat file.
To do is , i wrote a code in python like,
subprocess.call("C:\\Users\\Administrator\\Desktop\\Mainfile.bat",stdin=None, stdout=None, stderr=None, shell=False)
print "Finished"
Expected Output:
What want i want is,if i run a Mainfile.bat file ,that should executes the commands.In that, Each bat file in Mainfile.bat take some time to finish the process and it will automatically close once its finished. After finished running all those bat file(1.bat,2.bat,3.bat) only-- i need to print "finished" in console.
Actual output:
But,Once it run Mainfile.bat file , it executes the three bat files and it immediately print "finished" in console..How can i achieve the Expected output?
Got Expected Output :
By changing the content in the Mainfile.bat
(
start 1.bat
start 2.bat
start 3.bat
) | pause
echo done!