I have scripts that expect specific drive letters for hard drives. Windows sometimes assigns the different drive letters (e.g. I expected my Maxtor drive to be E:, but it's now F:, therefore my scripts will fail), depending on the order of how the drives are plugged into my laptop.

In Windows 7, how do I assign a permanent drive letter to a drive?


You can do this in Computer Management without external tools. The interface is slightly different in Windows 7 but the location is the same.

Start -> Type compmgmt.msc and press Enter -> Storage -> Disk Management


Press Win + x and then press k to choose Disk Management.

alt text

alt text

  • 6
    only works for drives that are fully compliant with the USB standard. many drives don't have a serial number and then the windows drive letter management fails when you reconnect the drive. – Molly7244 Feb 12 '10 at 21:19

The USB Drive Letter Manager for Windows is your friend.

USBDLM is a Windows service that gives control over Window's drive letter assignment for USB drives. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change drive letters. It automatically solves conflicts between USB drives and network or subst drives of the currently logged on user. Furthermore you can define new default letters for USB drives and much more.

Some key features:

  • Check if the letter is used by a network share of the currently logged-on user and assign the next letter that is really available.
  • Reserve letters, so they are not used for local drives.
  • Assign a letter from a list of new default letters, also dependent on many different criteria as the active user, drive type, connection (USB, FireWire), USB port, volume label, size and others.
  • Assign letters for a specific USB drive by putting an INI file on the drive.
  • Remove the drive letters of card readers until a card is inserted.
  • Show a balloon tip with the assigned drive letter(s).
  • Define autorun events depending on many different criteria.

Drive letters get "forgotten" when you assign a new drive to that letter. If you want multiple drives (for example, backup drives) to have the same remembered letter it is a pain, but there is a non-randomware way.

I felt the need to post this after scouring the Internet trying to find a solution for multiple drives that I wanted to rotate out, all retaining the same drive letter for my scripting joy. Sometimes whateverware (USBDLM) just isn't a good enough solution for your domain controllers, sensitive kiosks, etc., so we will do this the hard way.

If you don't have a lot of data or are starting from scratch, the easiest way is to disk to disk clone the device with the assigned letter to other devices using Clonezilla. But if you already have data on drives and can't backup/restore that data, or don't want to, or just like the hard way it appears to be associated with the volume GUID so you'll need to find a way to modify that on your existing volumes so that they all match and then do some testing. I did it the Clonezilla way. I haven't tried but imagine a partition clone would also work.

What I can verify for you is that it does not come from the disk id, so modifying this via diskpart is not helpful, and that you can get volume GUIDs using PowerShell:

GWMI -namespace root\cimv2 -class win32_volume

Hopefully somebody smarter than me can figure out how to change or specify volume GUID and test it out or at least determine if this is indeed where the reg value comes from so we can dynamically do this without cloning entire drives.

How it works:

When you assign a drive letter to a drive, Windows stores this in the registry under the key hklm\system\mounteddevices. You can observe that when you assign a new drive the X letter (for example) the data portion for the reg_binary (\dosdevices\x: in this case) is overwritten with the new drive and you can't have multiple entries with different values, so the next time you plug in that old drive it won't be X any more.

If you look at the reg_binary value itself it starts with dmio id followed by a GUID - which actually stems from the disk unique id. I don't actually understand the relation/translation into the binary reg vlaue except to say that it comes from the disk's unique id. I only say this to illustrate that we don't need to worry about volume GUIDs here, because the lettering all stems from the drives unique id. This may not be the case on MBR/Basic disks I'm only working with GPT dynamic disks here (and you probably are too).

Further reading/stuff I found:

Partitions and volumes https://social.technet.microsoft.com/Forums/en-US/e7b2ddd6-f245-49ed-8fec-3b6e08e75369/how-do-i-find-the-partition-guid?forum=winservergen

Volumes GUIDs and other things in mounteddevices https://morgansimonsen.com/2009/01/26/displaying-the-volume-guid-of-a-volume-2/

  • Trying to convey that if you clonezilla a disk you can use multiple pieces of hardware and all will retain the same drive letter - just don't plug them in at the same time. -oh and that there's a better way if you can manually edit the partition guid (I believe that's the basis) but I didn't get that far as my problem was solved – David Oct 15 '17 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.