2

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.

ale
  • 3,410
Rudy
  • 51

1 Answers1

4

It is possible using diskpart.

  1. Open Command Prompt.
  2. Type: "diskpart"
  3. 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.
  4. 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.
  5. 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