Search notes:

cmd.exe - mklink

Create symbolic links

By default, mklink creates symbolic links in NTFS.
administrator privileges are required to create a symbolic link unless Windows is put into developer mode.
The following example uses echo and the redirection operator (>) to create a file (target.txt) whose content is Some Text. Then, a symbolic link is created with mklink. Using type on sym.link shows the same content as is in target.txt:
@echo off

echo Some Text> target.txt
mklink sym.link target.txt
type            target.txt
Github repository about-cmd.exe, path: /commands/mklink/create-symbolic-link.bat

Create hard links

A hard link can be created with the /h flag:
mklink /h path\to\new-link path\to\existing-file
Hard links can only be created for files, not for directories.
No administrator privileges are required to create a hard link.

Create a junction

A junction is created with the /j flag:
mklink /j new\path old\path
No administrator privileges are required to create a junction.
In PowerShell, a junction can be created with new-item and -itemType junction:
new-item -itemType junction -path lnk -target existing-dir

See also

Reparse points
cmd.exe: Built-in commands

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1758201510, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/dirs/Windows/System32/cmd_exe/commands/mklink/index(79): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78