Forrest logo
back to the mklink tool

mklink:tldr:d7eac

mklink: Create a hard link to a file.
$ mklink /h ${path\to\link_file} ${path\to\source_file}
try on your machine

The "mklink" command is a Windows command used to create a symbolic link between files or directories. This command creates a hard link at a specified location to point to a source file or directory.

Here is a breakdown of the command you provided:

  • "mklink": This is the command itself. It is used to create symbolic links.
  • "/h": This is an option or a switch that specifies that you want to create a hard link. Hard links are a type of symbolic link that directly points to the source file or directory.
  • "${path\to\link_file}": This is the path where you want to create the symbolic link. Replace "${path\to\link_file}" with the actual path where you want the symbolic link to be created.
  • "${path\to\source_file}": This is the path of the source file or directory that you want the symbolic link to point to. Replace "${path\to\source_file}" with the actual path of the source file or directory.

For example, if you want to create a hard link at "C:\myfolder\mylink.txt" that points to "D:\data\myfile.txt", the command would look like this:

mklink /h C:\myfolder\mylink.txt D:\data\myfile.txt

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mklink tool