How to create a directory hard link in Windows?

I think that hard links are for files only and not directories.


There is no such thing as a hard link to a directory in Windows. In Windows, you either create a symbolic link to a directory by using the command mklink /d link_name target_dir or you create a junction with mklink /J link_name target_dir.

Differently of hard links, junctions may span multiple volumes and are sometimes called "soft links" by Microsoft, as you can read here:

A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories, and a junction can link directories located on different local volumes on the same computer.

Some caveat is required here since Microsoft's nomenclature is not really neat but, in a few words, these are your options to create references to files and directories in Windows:
(1) shortcuts: files whose content is the location of another file. It works more or less like a soft link, with a crucial difference though: it is NOT a directory entry, the link information is stored inside the file. For this reason, it doesn't work with many applications (at least, it works as it is supposed to within the Windows Explorer...);
(2) hard links: created with the command mklink /h. Valid for files only and works within a given volume (i.e., just like in Linux, you cannot hard-link a file in another partition nor in a network drive);
(3) junctions: this beast is really weird. It works with directories only, and - funny thing - can point to directories in other file systems;
(4) symbolic links: it is much like in Linux, and works with directories and files, too. (But tends to require Administrator privileges, which can make it rather inconvenient.) As I mentioned above, it is created with the command mklink /d link_name target_dir for directories (and mklink link_name target_file for files). You can read more about this here.