I'm tired of copying compiled binary file after downloading from the browser. So created this batch file for windows environment. Currently only check to work with HRM1017. Feel free to used it with other platform, but some modification could be required: 1. Only check D, E, F folder. 2. HRM1017 has "mbed.htm" in its folder. Used it as signature. 3. HRM1017 use "*.hex", other platform might use "*.bin"

I'm tired of having to copy the binary to mbed folder after compiling from the browser. So created this batch file for windows. It check for binary file every 5sec then automatically move the binary to mbed folder. Platform used is HRM1017. Some modification might be required to used for other platform:

1. Only check D, E, F folder.

2. HRM1017 use *.hex (other might use *.bin)

3. HRM1017 has "mbed.htm" in its folder. Using it as signature.

Run from download folder. There must be no other *.hex file in the folder.

mbed.bat

Committer:
devsar
Date:
2015-04-05
Revision:
0:a8820bfc02e8

File content as of revision 0:a8820bfc02e8:

@echo off
rem This batch will periodically:
rem   Check current folder if *.hex exist. (change to *.bin if required)
rem   Search each drive in the list for "mbed.htm" file.
rem   Then copy the file to that folder.
rem Note:
rem 1. Put this to where your browser download the compiled mbed file.
rem 2. There must be no other *.hex file in that folder.
rem 3. Only tested with HRM1017 (folder has "mbed.htm")
rem 4. Periodically check and copy for 5sec.

:START
rem check if *.hex file exist, then copy it to mbed folder
rem remove the file from folder after copy finished
if exist *.hex (
  rem check drive for "mbed.htm" file to determine
  rem mbed drive folder...
  for %%d in (d e f) do (
    if exist %%d:\mbed.htm (set DRIVE=%%d)
  )
  
  rem mbed folder not found, loop.
  if "%DRIVE%"=="" goto LOOP

  echo "Copying file..."
  forfiles /m *.hex /c "cmd /c copy @file %DRIVE%:\" >nul
  forfiles /m *.hex /c "cmd /c del @file" >nul
)

:LOOP
rem wait for 5000ms = 5sec, before restarting
ping 1.1.1.1 -n 1 -w 5000>nul
goto START

pause