USB Drive
Posted: 23 Oct 2014 13:40
I am trying to write batch file that will recognize a thumb drive and assign drive letter automatically.
For installing a program from the drive. I have tried a couple from the internet but they do not recognize my thumb drive.
This is one I tried:
It seems to be looking for the thumb drive but it stops searching at "H" and the drive assigned by computer is "J",
any help will be appreciated.

MOD EDIT: Added Code Tags.
For installing a program from the drive. I have tried a couple from the internet but they do not recognize my thumb drive.
This is one I tried:
Code: Select all
set "USBDRV="
for %%a in (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 "%%a:\$Emergency Plan 2014\" set USBDRV=%%a
)
if not defined USBDRV echo THE USB DRIVE WASN'T FOUND & pause&goto :EOF
echo copying Emergency Plan 2014 to Desktop
RD /s /q "%USBDRV%:\$Emergency Plan 2014"
xcopy "%USBDRV%:\JCSO Emergency Plan 2014 v. 200.exe\" to "C:\Emergency Plan 2014\" /s /c
pause
It seems to be looking for the thumb drive but it stops searching at "H" and the drive assigned by computer is "J",
any help will be appreciated.

MOD EDIT: Added Code Tags.