There was a flaw in the above code, in which the following code was involved. The code works in XP and gives you the letters of USB drives, if there is no USB device connected, this tells you that!
:: SUCCESS @ 2: 39 a.m. on October 12, 2013 !!! :: IMPROVED BOBBY GOREY
@echo off set usbdrv= set usb=No :: Above two lines on 12 Oct 2013 fsutil fsinfo drives >de type de | find "Drives:" /v >dlist for /F "tokens=1" %%c in ('type dlist') do ( for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do ( rem echo Token is %%d if %%d equ Removable ( echo Drive %%c is Removable (USB^) set usbletter=%%c set usb=Yes echo USB drive letter is %usbletter% rem set usbdrv = %%c <<< this does NOT work! rem echo USB1 drive letter is %usbdrv% ) ) ) del de del dlist echo REPEAT:Device at %usbletter% if "%usb%"=="No" echo No USB Device Connected . set usb=
source share