8

I can't figure out how to create shortcuts that don't care where they are mounted. For example, on my flash drive, I want to run CCleaner or Notepad++ in my college classroom. The problem is, a shortcut (at least with default settings) doesn't work reliably because it is tied to the same drive it was created on. Is there a way to do something like in HTML?

Example:

Here is where the actual program is:

Root\Portable Applications\Program Data\CCleaner\ccleaner.exe

Here is where I want the shortcut to be:

Root\Portable Applications\CCleaner.lnk

U3/Portable Apps/etc is not the solution I am looking for

Edit: The Versions of Windows will be XP 32 bit, Vista 64 bit, and Vista 32 bit

4 Answers 4

6

You can use mklink if on Vista or later to create symbolic links. They can be pointed to wherever you want. Alternatively a batch file as pointed out by pelms would work as well.

2
  • Hi John, thank you for your reply. When I try to use mklink, I get the error message, "The device does not support symbolic links." After a quick search, mklink isn't for FAT filesystems. If there are no other options, I will switch to NTFS for my thumb drive. Thank you again John for your answer.
    – Dan
    Commented Aug 23, 2009 at 7:22
  • 2
    Junctions are not the same as symlinks. Junctions can only point to directories, and work in a different way. Real Unix-like symlinks were added only in Vista. Commented Aug 23, 2009 at 10:09
9

Instead of using a shortcut you could create a batch file that uses a root relative path to the exe file.
e.g. for your example

@start "" "\Portable Applications\Program Data\CCleaner\ccleaner.exe"

The batch file should then work from anywhere on the USB drive, whatever the drive letter.

2
  • You can even change the icon if you want. don't know the portability of that.
    – Dykam
    Commented Aug 23, 2009 at 17:55
  • 2
    @Dykam. Can you change the icon for a .bat file without using Dan's method..?
    – pelms
    Commented Aug 23, 2009 at 19:29
4

Ok thank you guys for your replies. Here is what I ended up doing for any interested. pelms idea to use a batch file is almost it. (A Very good idea, thank you pelms) What I did was just make an AutoIt script that runs the apps in directories below it. Then I just compiled it with an extracted .ico from each executable file so everything looked pretty. Thanks again John and pelmsd

Run ('Program Data\PDF X-Change\PDFXCview.exe')

That is all the script consists of. Thanks again guys, I have linked the two programs I used if anyone is interested

AutoIt

IcoFX

0

You can put the following in the shortcut Target:

C:\Windows\System32\cmd.exe /c "start ./foo.bar"

However the Icon will be the cmd icon.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 20, 2023 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .