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@0:a8820bfc02e8, 2015-04-05 (annotated)
- Committer:
- devsar
- Date:
- Sun Apr 05 14:02:29 2015 +0000
- Revision:
- 0:a8820bfc02e8
Initial Release.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
devsar | 0:a8820bfc02e8 | 1 | @echo off |
devsar | 0:a8820bfc02e8 | 2 | rem This batch will periodically: |
devsar | 0:a8820bfc02e8 | 3 | rem Check current folder if *.hex exist. (change to *.bin if required) |
devsar | 0:a8820bfc02e8 | 4 | rem Search each drive in the list for "mbed.htm" file. |
devsar | 0:a8820bfc02e8 | 5 | rem Then copy the file to that folder. |
devsar | 0:a8820bfc02e8 | 6 | rem Note: |
devsar | 0:a8820bfc02e8 | 7 | rem 1. Put this to where your browser download the compiled mbed file. |
devsar | 0:a8820bfc02e8 | 8 | rem 2. There must be no other *.hex file in that folder. |
devsar | 0:a8820bfc02e8 | 9 | rem 3. Only tested with HRM1017 (folder has "mbed.htm") |
devsar | 0:a8820bfc02e8 | 10 | rem 4. Periodically check and copy for 5sec. |
devsar | 0:a8820bfc02e8 | 11 | |
devsar | 0:a8820bfc02e8 | 12 | :START |
devsar | 0:a8820bfc02e8 | 13 | rem check if *.hex file exist, then copy it to mbed folder |
devsar | 0:a8820bfc02e8 | 14 | rem remove the file from folder after copy finished |
devsar | 0:a8820bfc02e8 | 15 | if exist *.hex ( |
devsar | 0:a8820bfc02e8 | 16 | rem check drive for "mbed.htm" file to determine |
devsar | 0:a8820bfc02e8 | 17 | rem mbed drive folder... |
devsar | 0:a8820bfc02e8 | 18 | for %%d in (d e f) do ( |
devsar | 0:a8820bfc02e8 | 19 | if exist %%d:\mbed.htm (set DRIVE=%%d) |
devsar | 0:a8820bfc02e8 | 20 | ) |
devsar | 0:a8820bfc02e8 | 21 | |
devsar | 0:a8820bfc02e8 | 22 | rem mbed folder not found, loop. |
devsar | 0:a8820bfc02e8 | 23 | if "%DRIVE%"=="" goto LOOP |
devsar | 0:a8820bfc02e8 | 24 | |
devsar | 0:a8820bfc02e8 | 25 | echo "Copying file..." |
devsar | 0:a8820bfc02e8 | 26 | forfiles /m *.hex /c "cmd /c copy @file %DRIVE%:\" >nul |
devsar | 0:a8820bfc02e8 | 27 | forfiles /m *.hex /c "cmd /c del @file" >nul |
devsar | 0:a8820bfc02e8 | 28 | ) |
devsar | 0:a8820bfc02e8 | 29 | |
devsar | 0:a8820bfc02e8 | 30 | :LOOP |
devsar | 0:a8820bfc02e8 | 31 | rem wait for 5000ms = 5sec, before restarting |
devsar | 0:a8820bfc02e8 | 32 | ping 1.1.1.1 -n 1 -w 5000>nul |
devsar | 0:a8820bfc02e8 | 33 | goto START |
devsar | 0:a8820bfc02e8 | 34 | |
devsar | 0:a8820bfc02e8 | 35 | pause |