0

If I have a file named "C\Test\mypic.jpg", can I create a shortcut with path "C\Test2\mypic.jpg"? Windows always seems to add a ".lnk" suffix, which is unwanted in my case.

Wild Pottok
  • 318
  • 3
  • 8
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 11 '21 at 09:58

1 Answers1

2

Link in this case can mean several things but we can unpack all the possible scenarios:

  • A shortcut (.lnk file). These files must have the .lnk extension because the file extension is how Windows decides which handler to invoke when you double-click/execute the file. If you create a shortcut to a jpg file the real name can be link.jpg.lnk but the user will see the name as link.jpg in Explorer because .lnk is a special extension that is hidden.

  • A symbolic link (symlink). These are links on the filesystem level and can have any extension. mklink "c:\mylink.jpg" "c:\file.jpg"

  • A hardlink. This is another name for the same file (alias), it does not create a shortcut. mklink /H "c:\anothername.jpg" "c:\file.jpg"

Anders
  • 97,548
  • 12
  • 110
  • 164
  • 1
    To use the mklink executable, a console must be run as Administrator. I also had to remove the .exe extension (so 'mklink' alone). – Wild Pottok May 09 '22 at 20:30
  • 1
    @WildPottok You can create a hardlink without admin rights. If you turn the developer mode on you can probably do it with symlinks as well. – Anders May 09 '22 at 21:08