Answer for:

Force thumb drive or flash drive to same drive letter each time?

Message 6 of 15

View entire thread
0 Votes

...this is a bit easier and does the same....

@echo off
echo select volume %cd:~0,1% > diskpart.inp
echo assign letter=b noerr >> diskpart.inp
diskpart /s diskpart.inp
del /s diskpart.inp

.... if "letter" is already taken, nothing happens.
It's quicker for it obtains the current drive from %CD% with no loop and no need for a .ini file. On the other hand you may have to edit the batch for any usb drive you have.

I love "B:" for it reminds me of my ole 5.25" drive :-)