Permanently assign drive letters for USB drives


  1. Posts : 51
    Windows 10
       #1

    Permanently assign drive letters for USB drives


    Hi,

    I run a backup script to different USB drives at different times.

    The backup script always needs to see the same drive letter for the USB drive (whichever USB drive is being used).

    I know you can run compmgmt.msc, select Disk Management and then click 'Change drive letter and paths' to manually set a drive letter.

    However, sometimes Windows remembers the drive letter that was manually set, but sometime it forgets.

    Is there a way to permanently set a drive letter assignment for the USB drives?

    Thanks in advance :)
      My Computer


  2. Posts : 51
    Windows 10
    Thread Starter
       #2

    One other thought, if there isn't a way to permanently set a drive letter to the USB drives, is there a registry key which can make the change (that way I can just click a .reg file to make the change....)

    Thanks!
      My Computer


  3. Posts : 19,518
    W11+W11 Developer Insider + Linux
       #3

    I don't know of any way to do it natively from Windows because drive letter is windows function and doesn't stay on the drive itself.
    You can try this: Download USB Drive Letter Manager (USBDLM) - MajorGeeks for instance.
      My Computers


  4. Posts : 42,921
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    robocop said:
    Hi,
    I run a backup script to different USB drives at different times.
    The backup script always needs to see the same drive letter for the USB drive (whichever USB drive is being used).

    I know you can run compmgmt.msc, select Disk Management and then click 'Change drive letter and paths' to manually set a drive letter.

    However, sometimes Windows remembers the drive letter that was manually set, but sometime it forgets.
    Using Disk Management is what I do - no problems I've noticed. But I could believe your experience...
      My Computers


  5. Posts : 5,478
    2004
       #5

    You could also check that you are using the correct USB in your script so you don't backup to the wrong one...

    For example, make a small file on your USB F drive called USBF...
    Code:
    if exist "F:\USBF" (
        rem whatever you want to do....
    ) else (
        echo Drive letter is wrong.
    )
      My Computer


  6. Posts : 51
    Windows 10
    Thread Starter
       #6

    Thanks very much for the replies.

    lx07, that's an awesome idea which I didn't realise was possible. If the drive letter was wrong my batch script was running and completing as though it had been successful - Doh! I've now added your code to the script with a pause, so it now stops if it can't find the right file. Perfect!

    Cheers
      My Computer


  7. Posts : 20
    Win10
       #7

    Code:
    set USBDRIVE=
    FOR %%D IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (DIR %%D:\USB.TAG  > nul 2>&1 && (call set USBDRIVE=%%D:)
    if "%USBDRIVE%"=="" echo ERROR: NO USB DRIVE FOUND & pause
    echo USB IS %USBDRIVE%
    Use this to search all drive letters for \USB.TAG file.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:05.
Find Us




Windows 10 Forums