How can I permanently assign drive letters to my USB devices in Windows?

8

4

I have several customers with different PCs (Windows XP, Windows Vista and Windows 7).

Unlike DOS 6.22, where you can permanently assign drive letter designations (e.g. Drive C: = Hard Disk Bootable Partition, Drive D: = CD Drive, or any additional partitions you want to create with FDISK, depending on which version of Windows you are running), if in Windows XP I connect a USB flash drive, it will assign it drive E:, in Windows Vista it will assign it drive F:.

In DOS 6.22, when you have LASTDRIVE=Z: in your CONFIG.SYS file, you can then statically assign permanent logical drive designations to any devices whether you connect them or not.

Why can't this be done in Windows? I have no way to create standardized backup PowerShell or batch file scripts!

Frank R.

Posted 2011-07-05T22:45:11.027

Reputation: 431

Based on all the answers I've seen so far, there's no way to permanently reserve a logical drive letter for an external device in Windows!.. a flaw! – Frank R. – 2011-07-05T23:25:59.540

1The drive letter is stored in the windows registry, not on the device, windows looks at the device ID and checks the windows registry and assigns the drive letter based on that, if there is no pre assigned letter it will assign the first unused drive letter. so no way to do what you want from PC to PC other than assign the same drive letter for each device on each PC. It is always better to assign a letter farther down the alphabet, that way there are no collisions with drive letters already occupied on any given PC. – Moab – 2011-07-05T23:29:23.390

@Moab: I'll use your suggestion to assign an X: Y: or Z: although maybe I can devise a scheme to identify an attached device by volume label name. I think this is where Microsoft missed the boat with Windows!.. They used the same scheme used in DOS to identify devices whereas in UNIX everything, devices included, is a file in the filesystem, example: /dev/fd0 = diskette drive, /dev/hd0 = logical hard disk 0.. Now in Windows, we have floating (variable) logical devices besides all the other similarities with DOS, including security issues which have never been a problem with UNIX-bases systems! – Frank R. – 2011-07-05T23:51:56.350

Yup, Windows sucks, let us count the ways... – Moab – 2011-07-06T00:01:11.957

Answers

12

You can setup Windows so that it remembers the drive letter you asign to a drive, but you have to connect the device and set it up first. This can be done in the Control Panel > Administrative Tools > Computer Management (or run compmgmt.msc if you're as lazy as me). Under Storage > Disk Management, right-click on the drive you want to configure and select Change Drive Letter and Paths.... There you can change the drive letter that's assigned to the drive.

After this is done, whenever the drive is plugged back in, this letter will be used if it's available. If this is too risky for you, you can mount the drive in an empty folder anywhere on the filesystem instead (via the same interface). This works the same as the drive letter in the sense that Windows will only use it if it's available, but it will never do it unless it's explicitly setup to do so.

Martin Larente

Posted 2011-07-05T22:45:11.027

Reputation: 388

I have found that even when I force assign the drive letter to my USB drive, that Windows 7 will often take that drive letter assignment and use it (or reserve it) after I have dismounted it. I normally want to assign my portable drive to G: at work. I unmount the drive and when I plug it back in the next day, Windows 7 often refuses to reassign it back to G:. It will instead assign it to H:. Even worse is that Windows 7 doesn't have G: available to be reassigned to. The logical drive letter is missing from the available list until I reboot - then I can force the assignment back to G:. – John C – 2016-08-16T15:43:20.210

I think this is the best way to do it. Make sure to use higher drive letters so that other removable devices don't steal the next available driver letter and cause a conflict. – Chris Thompson – 2011-07-05T23:14:15.133

@Martin: You see?.. "...if it's available." meaning there's no way in Windows to guarantee that letter will be available if another device takes it, which in the real world, frequently happens! – Frank R. – 2011-07-05T23:21:23.613

4@Frank Computer: then you can use an empty directory to mount the device instead. It won't be used up by another drive unless it's manually configured that way. – Martin Larente – 2011-07-05T23:32:04.197

@Frank Computer: This is why you start your "static" drive letter assignments with Z:. If you have more than 20 different USB devices, you're in trouble no matter what you do. USBDLM works fairly well as @Mike Renfro mentions below.

– Bacon Bits – 2011-07-06T04:47:36.703

4

Instead of trying to define a standard drive letter for your scripts, define an environment variable that you set on each system to designate the USB drive.

Mark Ransom

Posted 2011-07-05T22:45:11.027

Reputation: 2 010

or perhaps better to use volume name vs. drive letter? – Frank R. – 2011-07-05T23:45:39.770

3

One word: USBDLM.

  • automatically solves conflicts between USB drives and network or subst drives of the currently logged on user
  • you can define new default letters for any/all USB drives
  • you can make your 19-in-1 card reader only allocate drive letters for slots that have media inserted
  • you can assign default drive letters based on
    • bus type
    • usb port number
    • drive type (CD, removable, fixed)
    • drive size
    • device ID
    • presence of files/folders
    • volume label
    • volume serial number
    • ...

32-bit and 64-bit versions available. This gets installed on each and every Windows system I install. No registry hackery, no disk management tool required, it just works as a persistent service. I cannot recommend this highly enough.

Mike Renfro

Posted 2011-07-05T22:45:11.027

Reputation: 1 242

3

Create your batch file scripts using %~d0 as the drive letter and colon. %~d0 is replaced by the drive containing the script. So if on one machine the thumb drive is F %~d0 is equivalent to F: On another machine the thumb drive is W %~d0 is equivalent to W:

All my scripts are this way because I use my thumb drive in 100s of machines

Kevin

Posted 2011-07-05T22:45:11.027

Reputation: 1 873

1

You can use also Disk Management (part of Computer Management) to give the volume a specific drive letter.

Neil

Posted 2011-07-05T22:45:11.027

Reputation: 598

1

Windows remembers drives based on an ID it gets from the drive itself. It tries to assign the original drive letter it first assigned it, but will assign another if that is in use. You can see Windows' memory of them in HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices (be very careful if you ever edit values under this key).

If you go into Computer Management (Control Panel > Administrative Tools > Computer Management, or just Run compmgmt.msc) and select Disk Management, you will be able to set the drive letter there by right-clicking on the drive and selecting "Change Drive Letter and paths...". Once you have changed it, Windows will afterward attempt to re-use that drive letter when the recognized device is reconnected. You could use this to set the same drive letter for the device on each machine it will be used on.

Joel B Fant

Posted 2011-07-05T22:45:11.027

Reputation: 73

0

You could try using USBDeview.

enter image description here

Find the device in the list, right-click and choose Change Assigned Drive Letter, then set it to the letter you would prefer. If I remember correctly, it is persistant.

Ruairi Fullam

Posted 2011-07-05T22:45:11.027

Reputation: 2 284

Doesn't work for me if Windows has taken and used my previous drive assignment (see my comments above), even when running as Admin. My drive will stay as H: if Windows decides has "taken" my previous G: letter. Only a reboot and a forced assignment will work for me. Reboot frees the "reserved" G: (in my case) and then I can reset and force my drive with Mini Tool back to G (with Admin rights). – John C – 2016-08-16T15:39:15.753