12

I'm trying to write a batch file that will automate the following manual process:

  1. Open a new cmd prompt (prompt1)
  2. Run a bat file (b1)
  3. Run a program (that will continue to run)
  4. Minimize prompt1
  5. Open a new cmd prompt (prompt2)
  6. Run a bat file (b1)
  7. Run a different program (that will continue to run)
  8. Minimize prompt2

I've found ways to open multiple instances of cmd to run different things, but after I've run the first thing (b1), I then need to run a program in that same cmd window.

I currently have:

start /min cmd /k C:\Users\db2admin\python_environment\Scripts\activate.bat
start /min cmd /k C:\Users\db2admin\python_environment\Scripts\activate.bat

This opens the two windows and runs the bat file; great, but now I need to execute another command (running a python file) in each of the cmd windows. How do I send commands to each prompt?

5
  • 2
    So far this is a great list of what you want, but not a good question. :) What have you come up with already? Where are you getting stuck? What have you tried already? Nov 13, 2012 at 15:40
  • Literally have done nothing as I've never done batch scripting before. This is a process I currently do manually and want to give a one-click runnable to someone else so they don't have to do this process. Nov 13, 2012 at 15:42
  • Well we're not really here to write free scripts for you. We're here to help with, and offer suggestions for, problems you run into while doing things. :) Perhaps check out the Chat rooms, you may be able to find someone in there willing to consult with you on this at their regular fees. Nov 13, 2012 at 15:47
  • @studiohack Why was my answer deleted?
    – Bali C
    Nov 13, 2012 at 15:56
  • @techie007 see edit. Nov 13, 2012 at 16:07

1 Answer 1

13

Try using this

start /min cmd /c batch1.bat && start program1.exe
start /min cmd /c batch2.bat && start program2.exe
1
  • @johnharris85 Maybe accept this answer? As it is the only one, and has helped several people.
    – Engineer
    Feb 3, 2020 at 14:03

Not the answer you're looking for? Browse other questions tagged .