Symlinks (hard shortcuts) under Windows

Being a Linux user I am used to the fact that I can create symlinks (like shortcuts under Windows) pretty much everywhere without any issues at all. It turns out that shortcuts under Windows don’t work quite the same way. The Windows shortcuts are not becoming part of the file system but are file explorer internally only. This is not an issue as long as you want to work within the file explorer. However, you cannot use that shortcut to eg. pass it as a path parameter to a program.

This is exactly the issue I had: Using the make build system (Makefile) I wanted to pass the uGFX library path as a shortcut. While it worked perfectly within the explorer make complained that it cannot find the path specified. This can be fixed by not creating the shortcut in the file explorer but directly within the file system environment (through the command line) itself using the command mklink.
mklink takes the following parameters:

  • /D – Creates a soft symbolic link, similar to the shortcut that you can create in the file explorer
  • /H – Creates a hard link to a file
  • /J – Creates a hard link to a folder

Therefore, I was able to create my shortcut using the following command:

mklink /J C:\ChibiStudio\ugfx C:\Users\Tectu\Documents\projects\resources\ugfx


  • The created symlink will also show up in the file explorer and you can use it just like your regular shortcut.
  • The created symlink stays alive across reboots.
  • You can delete the created symlink like any regular file. It won’t delete the source.
  • This only works on the NTFS file system. FAT does not provide this feature.

At this point I’d like to thank Xark from FreeNode for providing me with this solution.

Leave a Comment

Your email address will not be published.