is ant
a batch file?
If so, try (or try anyway)
CALL ant run
OR
START "windowname" ant run
where you can add /wait
to the START
command to have the batch wait for the first ant
to finish before proceeding.
see
`start /?`
from the prompt for docco.
(following comment)
Here is your original code:
start cmd
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java2
ant run
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java3
ant run
What this should have done is:
- Start a brand-new CMD window
- change to the specified sirectory
- Start the executable
ant
with the parameter run
Now - I've just downloaded ANT
and I find that it includes ANT.BAT
and ANT.CMD
but NOT ANT.EXE
.
In your environment, you would have a variable called PATHEXT
whis is a semicolon-separated list of the valid executable extensions, in order of selection. In all probability, unless you've taken specific action to change it, this will be PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
What this means is that the ANT that will be executed is ANT.BAT
if you've added its directory to your path (which, I believe, is in the instructions)
So executing the ANT.BAT
will TRANSFER execution to ANT.BAT
.
SO:
I see no reason why you are producing a new CMD
window.
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java2
CALL ant run
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java3
CALL ant run
should work.
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java2
START /wait "First ANT" ant run
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java3
START /wait "Second ANT" ant run
should also work.
Note the position of the /wait
If it follows the start
then cmd knows it's a start
parameter. If it follows ant
then cmd will assume it's an ant
parameter.
The /wait simply tells CMD to WAIT until the executable is finished before continuing.
This:
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java2
START "First ANT" ant run
cd /d C:\Users\MeUser\Downloads\selenium-grid-1.0.8\examples\java3
START "Second ANT" ant run
should also work, but this time the second ANT instance will be started in parallel with the first (well, milliseconds later)
Note also the "quoted string"
before the ant
. The syntax of the START statement is to allow a "quoted string"
as a window title. The quoted string may be empty ""
if you wish. You can even omit the quoted string altogether EXCEPT if the executable is quoted, in which case the window title is required
.