Creating a batch to start sitl the way i want

Hi !

I am using sitl on wsl to simulate a rover and copter and then making copter follow rover and then trying to land on rover. To do this I use 3 cmd windows, the first one launches sitl for a quad copter with --no-mavproxy, the second launches sitl for a rover with --no-mavproxy and -I 2. Then in the third cmd prompt I use mavproxy to connect both, give a sysid of 16 for the rover, then set foll params and set fwdpos true on the copter, setting guided mode and arm and takeoff, then I set fwdpos true on rover arm and set rc 3 to 1750 and rc 1 to 1450 just to make it move.
Finally when copter is ready i set follow mode.

All of this works great but i spend few minutes preparing this each time. I would like to create a batch file to prepare all this for me. I tried it and were able to create my two vehicles using this script :


@echo off
start wsl.exe -e bash -c "cd ~/ardupilot/ArduCopter && ../Tools/autotest/sim_vehicle.py -L Almanarre --no-mavproxy"
echo drone copter simule
start wsl.exe -e bash -c "cd ~/ardupilot/Rover && ../Tools/autotest/sim_vehicle.py -L Almanarre --no-mavproxy -I 2"
echo drone bateau simule

Now I wrote a second script to launch mavproxy and write my commands but it failed, i feel like there is not enough time between the moment when i arm and the moment i give my other orders but if I use the timeout /t 2 /nobreak command i can’t give other orders.

Here’s my attempt :

@echo off
echo about to open mavproxy and connect vehicles
timeout /t 10 /nobreak

start wsl.exe -e bash -c "mavproxy.exe --master=tcp:127.0.0.1:5780 --cmd="param fetch; param set SYSID_THISMAV 16"

echo connected to rover, changed sysid.
echo  

timeout /t 2 /nobreak

wsl.exe -e bash -c "pkill -f mavproxy.exe"

timeout /t 2 /nobreak

wsl.exe -e bash -c "mavproxy.exe --master=tcp:127.0.0.1:5760 --master=tcp:127.0.0.1:5780 --map --cmd="vehicle 16; set fwdpos true; mode manual; arm throttle; rc 3 1800; rc 1 1450; vehicle 1; param fetch; param set foll_enable 1; param fetch; param set foll_ofs_z -10; param set foll_sysid 16; set fwdpos true; mode guided; arm throttle; takeoff 10;"

timeout /t 10 /nobreak

wsl.exe -e bash -c "mavproxy.exe --cmd="mode follow"

timeout /t 10 /nobreak

wsl.exe -e bash -c "mavproxy.py --master=tcp:127.0.0.1:5760 --cmd="param fetch; param set foll_enable 1; param fetch; mode guided; arm throttle; takeoff 10;set fwdpos true"

echo ended script, debug 
echo 

timeout /t 30 /nobreak

Any help would be apreciated. Thanks and have a good day !