Is it possible to use a .bat file to change a USB drive letter or is there a command line to change a drive-letter and place that in a .bat file?
All of this is in Windows 7.
Asked
Active
Viewed 1.3k times
2
1 Answers
4
It is possible using diskpart.
- Open Command Prompt.
- Type: "diskpart"
- At the DISKPART prompt, type: "list volume" and make note of the number of the simple volume whose drive letter you want to assign, change, or remove.
- At the DISKPART prompt, type: "select volume n" Select the volume, where "n" is the volume's number, whose drive letter you want to assign, change, or remove.
- At the DISKPART prompt, type one of the following: "assign letter=L" where "L" is the drive letter you want to assign or change or "remove letter=L" where L is the drive letter you want to remove.
If you want to use all of this in a batch file you can put your diskpart commands in a text file, one command per line. Then, call it from within a batch file using "diskpart /s file.txt". See: DISKPART Scripting
Source: Microsoft
Jack
- 1,343