-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathmassStorageCopy.bat
41 lines (35 loc) · 989 Bytes
/
massStorageCopy.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off
set SOURCE=%2
set SRC_PARSE=%SOURCE:/=\%
set TARGET=%4
set TARGET=%TARGET:\=%
call :parse %TARGET%
echo %TARGET% not found. Please ensure the device is correctly connected.
exit 7
:parse
set list=%1
set list=%list:"=%
for /f "tokens=1* delims=," %%a in ("%list%") do (
if not "%%a" == "" call :sub %%a
if not "%%a" == "" call :nod %%a
if not "%%b" == "" call :parse "%%b"
)
goto :eof
rem Try with the short name NOD_XXX
:nod
setlocal enabledelayedexpansion
echo.%~1|findstr /C:"NODE_" >nul 2>&1
if not errorlevel 1 (
set name=%~1
call :sub !name:E_=_!
)
goto :eof
:sub
setlocal enabledelayedexpansion
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%~1'" get deviceid 2^>NUL') do if not defined id set id=%%a
call set "deviceid=%%id: =%%"
if not "%deviceid%" == "" (
%~dp0busybox.exe cp -f %SRC_PARSE% %deviceid%
if !errorlevel! == 0 (echo Upload complete on %1 ^(%deviceid%^))
exit !errorlevel!)
goto :eof