REM 2 | The user pressed CTRL+C to terminate xcopy.
REM 4 | Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
REM 5 | Disk write error occurred.
SETSOURCE=%2
SETSRC_PARSE=%SOURCE:/=\%
SETTARGET=%4
SETTARGET=%TARGET:\=%
call:parse%TARGET%
echo%TARGET% not found. Please ensure the device is correctly connected.
exit 7
:parse
setlist=%1
setlist=%list:"=%
for/f"tokens=1* delims=,"%%a in("%list%")DO(
ifnot"%%a"==""call:sub%%a
ifnot"%%b"==""call:parse"%%b"
)
goto:eof
:sub
setlocal enabledelayedexpansion
for/F"skip=1 tokens=*"%%a in('WMIC LOGICALDISK where "volumename like '%~1'" get deviceid 2^>NUL')doifnotdefinedidsetid=%%a
callSet"deviceid=%%id: =%%"
ifnot"%deviceid%"==""(
XCOPY %SRC_PARSE%%deviceid% /Y /Q
if!errorlevel!== 0 (echo Upload complete on %1^(%deviceid%^))