Running multiple commands simultaneously

12,643
start "" /d "c:\users\administrator\desktop\chps\chp1" php checker.php
start "" /d "c:\users\administrator\desktop\chps\chp2" php checker.php
start "" /d "c:\users\administrator\desktop\chps\chp3" php checker.php

In above code snippet:

  • start command starts a separate Command Prompt window to run a specified program or command.
  • /d switch specifies the startup directory for new Command Prompt.

You could ensure and force creating a new instance of the command interpreter (Cmd.exe) as follows:

start "" /d "c:\users\administrator\desktop\chps\chp1" cmd /C php checker.php
start "" /d "c:\users\administrator\desktop\chps\chp2" cmd /C php checker.php
start "" /d "c:\users\administrator\desktop\chps\chp3" cmd /C php checker.php
Share:
12,643

Related videos on Youtube

Mohammed naji
Author by

Mohammed naji

Senior Software Engineer and Senior Javascript full stack developer

Updated on September 16, 2022

Comments

  • Mohammed naji
    Mohammed naji 3 months

    I have a script that will run open multiple cmd windows and run different php commands in each window. Unfortunately, my current code waits for the first set of PHP commands to finish before the second set of PHP commands starts, defeating the purpose of opening multiple windows.

    Is it possible to run all sets of PHP commands in separate cmd windows simultaneously?

    My current code:

    start
    cd c:\users\administrator\desktop\chps\chp1
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp2
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp3
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp4
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp5
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp6
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp7
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp8
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp9
    php checker.php
    start
    cd c:\users\administrator\desktop\chps\chp10