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.2k times
2
-
Don't use a bat, that is the old way. The new way is Powershell. http://blogs.technet.com/b/heyscriptingguy/archive/2011/03/14/change-drive-letters-and-labels-via-a-simple-powershell-command.aspx – Zoredache Sep 03 '13 at 16:40
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,303
- 8
- 7