Find the Drive Letter for a USB plug by either Volume Label or by an existing file.
@ECHO OFF FOR %%d IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%d:\TheUSB.txt SET USBDrv=%%d: Echo "The USB is %USBDrv%" Pause for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "TheUSB"') do set usbdrv=%%D Echo "The USB is %USBDrv%" Pause