This batch script is supposed to detect removable drives, and loop though the following process for each drive: format, wrtie files to. Problem is that it only does this for one drive. For example, I can put two drives in, it will detect them both and process the loop on on of them two times. The issue has something to do with the variable of the drive name being updated, but I am not all that savy with batch script. If there is another answer already on this site, I wouldn't know what it looks like because I don't know everything about the commands (i have look at all of the suggestions given). I appologize if this is a repeat question. Just point me in the right direction and I will be on my way!
@echo off
setlocal enabledelayedexpansion
for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do (
for %%c in (%%b) do (
echo Starting loop with %yyy%
for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do (
if %%d equ Removable (
echo Drive written to is %yyy%
format /y %yyy:~0,2% /fs:FAT32 /v:LCM2014 /q
)
set yyy=%%c
echo Ending loop with %yyy%
)
)
)