I would like to expand on a question asked a few years ago "xcopy files to usb drive if you do not know what the drive letter is
Which resulted in some great code that resolved it.
for /f "tokens=1-3" %%a in ('wmic logicaldisk get caption^, description') do if "%%b %%c"=="Removable Disk" set drive=%%a&goto FOUND
echo Couldn't detect removable drive
echo Removable drive letter is %drive%
xcopy "X:\Emergency Planning\test\*.*" "%drive%\" /C/E/H/R/K/D/M/Y
This code works fine if there is just one USB device but when more than one it finds the first removable media drive and fails if it is not the drive with the media card in place.
I would like to xcopy files to a specific USB drive (with a given Name and that drive only) when he BAT file is executed.
Is this possible to do?