Updated Nucleo flasher bat for Windows

This commit is contained in:
Roger Clark 2016-11-14 09:26:47 +11:00
parent 221cb35f42
commit 243fb9cb8c

View file

@ -1,16 +1,9 @@
@ECHO off
SET SOURCE=%2
SET SRC_PARSE=%SOURCE:/=\%
SET TARGET=%4
FOR %%I IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
VOL %%I: 2>NUL | FIND "%TARGET%" >NUL && SET DEST=%%I:
)
IF DEFINED DEST (
XCOPY %SRC_PARSE% %DEST% /Y /Q >NUL
) ELSE (
ECHO %TARGET% not found. Please ensure the device is correctly connected
EXIT /B 1
)
setlocal enabledelayedexpansion
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%TARGET%%%'" get deviceid') do if not defined id set id=%%a
Call Set "deviceid=%%id: =%%"
if not "%deviceid%" == "" (XCOPY %SRC_PARSE% %deviceid% /Y /Q >NUL
echo Upload complete ) else ( echo %TARGET% not found. Please ensure the device is correctly connected)