Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

migrated from stackoverflow.com Jul 5 '11 at 22:51

This question came from our site for professional and enthusiast programmers.

    
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! –  FrankComputerAtYmailDotCom Jul 5 '11 at 23:25
1  
The 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 Jul 5 '11 at 23:29
    
@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! –  FrankComputerAtYmailDotCom Jul 5 '11 at 23:51
    
Yup, Windows sucks, let us count the ways... –  Moab Jul 6 '11 at 0:01

7 Answers 7

up vote 4 down vote accepted

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.

share|improve this answer
    
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 Jul 5 '11 at 23:14
    
@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! –  FrankComputerAtYmailDotCom Jul 5 '11 at 23:21
2  
@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 Jul 5 '11 at 23:32
    
@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 Jul 6 '11 at 4:47

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer
    
or perhaps better to use volume name vs. drive letter? –  FrankComputerAtYmailDotCom Jul 5 '11 at 23:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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