How to Script an MDB Session

An MDB script is nothing more than a text file with a sequential list of commands. Hash marks (#) indicate comments.

# mdbscript.txt
#
device PIC32MX220F032B
hwtool SIM
program "C:\MTT\TLS0102\MDB_Simulator.X\dist\default\debug\MDB_Simulator.X.debug.elf"
break BlinkLED.c:57
reset MCLR
sleep 1500
run
wait
print LATA
continue
wait 600000
halt
print LATA

To run the script, simply pass the text file as a parameter to MDB:

mdb.bat "C:\Projects\MyProject\mdbscript.txt"