Assign the Same drive letter to USB Drive
Everyone knows how frustrating it is to have to manipulate file paths or change settings based on the drive letter that is assigned to your USB key drive. If you do not want to go through the hassle of launching disk management and assigning the letter manually that way, you can use a batch file to assign a drive letter to your USB key much more quickly.
You need two files:
driveletter.bat
driveletter.txt
Driveletter.bat Contents:
diskpart /s driveletter.txt
pause
Driveletter.txt Contents:
select disk 1
select partition 1
assign letter=M
In the file(s) above, we are assuming that your USB key is the only other drive that is attached to your computer besides the internal hard drive. If for instance you have two physical drives already there, then you will probably be looking at “disk 2” as your USB drive disk number. To be sure though, go to a command prompt and type the following:
diskpart
list disk
Take note of which disk number your USB drive is in the table. Also, the letter listed above “M” can be anything you want it to be that is free.
Place each of the files on your desktop or another location that is convenient to access. After you insert your USB key into your computer, simply run the batch file that you created.