Formatting multiple flash drives

I work in a training lab and often need to format flash drives for the training class, typically 25 at a time. is there any way, a program or script, to format these with a name and as NTFS without me needing to do them one at a time?

thanks

Do they all need the same volume name?

yes

DISCLAIMER! BACK YOUR STUFF UP. THIS FORMATS DRIVES!

Ok this script will loop through drives D through Z. On each of these drives it will search for a file called "killswitch.ini" (this is just an empty file) if it finds the file it will format the drive and replace the killswitch.ini file with a new one.

copy and paste this code into a text file and name it something like "FormatFlash.cmd".

You can change the volume label by replacing /V:TRAINING with /V:yourvolumlablehere

This is semi automatic but should save you lots of time. It will ask you to press enter when ready for each drive letter. If you replace the /Q switch with the /Y switch it will be fully automatic, however it will do full formats on each drive and take much longer. Unfortunately the quite mode (fully automatic) is not compatible with the /q (quick format) switch.

BE CAREFUL WITH THIS. I LEFT THE C DRIVE OUT ON PURPOSE. IM NOT RESPONSIBLE FOR JACK ;)

@ECHO OFF
ECHO PRESS ANY KEY TO START DRIVE FORMATTING OR CLOSE THIS WINDOW NOW
PAUSE
SET DRIVES[0]=D:
SET DRIVES[1]=E:
SET DRIVES[2]=F:
SET DRIVES[3]=G:
SET DRIVES[4]=H:
SET DRIVES[5]=I:
SET DRIVES[6]=J:
SET DRIVES[7]=K:
SET DRIVES[8]=L:
SET DRIVES[9]=M:
SET DRIVES[10]=N:
SET DRIVES[11]=O:
SET DRIVES[12]=P:
SET DRIVES[13]=Q:
SET DRIVES[14]=R:
SET DRIVES[15]=S:
SET DRIVES[16]=T:
SET DRIVES[17]=U:
SET DRIVES[18]=V:
SET DRIVES[19]=W:
SET DRIVES[20]=X:
SET DRIVES[21]=Y:
SET DRIVES[22]=Z:
ECHO PRESS ANY KEY TO START DRIVE FORMATTING OR CLOSE THIS WINDOW NOW.  LAST CHANCE!
PAUSE

FOR /F "TOKENS=1* DELIMS==" %%D IN ('SET DRIVES[') DO (
	IF EXIST %%E\KILLSWITCH.INI ECHO FORMATTING %%E
	IF EXIST %%E\KILLSWITCH.INI FORMAT %%E /FS:NTFS /V:TRAINING /X /Q & ECHO > %%E\KILLSWITCH.INI
)
ECHO PROCESS FINISEHD
PAUSE

Thanks, I will try that.

If you call the batch file from the command line like this:

echo y| mybatchfile.bat

Then it will feed the y into the program for you to auto accept each one, then you can use Q.

The other option is to build a text file for diskpart to use and pass it a variable that it found from a text file in loop.

1 Like