As in, if my external hard drive is labeled K: on PC1, then I might have a shortcut to K:/Books. But then if I move the external hard drive to another computer, it might be labeled M:, and the shortcut will fail to work

I know that I can change the drive letters, but the issue is that the drive name often changes if I insert the hard drive into a different USB port (even on the same computer).

  • 2
    When I was doing PortableApps.com work, I wrote a little utility that would create shortcuts on your desktop when you ran it that would change based on the drive letter. Think I called it UUPADA. I can probably dig up the code if you'd like.
    – digitxp
    Aug 31, 2011 at 23:22

1 Answer 1


Use batch files

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 external drive is F %~d0 is equivalent to F: On another machine the external drive is W %~d0 is equivalent to W:

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

  • 1
    +1: This is how Windows does it also for your roaming profiles.
    – surfasb
    Aug 31, 2011 at 23:39

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.