mklink

Windows CMD · Files · reference only

What it does

Creates symbolic links, hard links and junctions between files and folders.

Syntax

mklink [/D | /H | /J] enlace destino

Options and parameters

  • enlace destino

    Without options it creates a symbolic link to a file.

  • /D

    Creates a symbolic link to a directory.

  • /H

    Creates a hard link: another name for the same file on the same volume.

  • /J

    Creates a junction, a link to a directory inside the machine.

Usage examples

  • mklink enlace.txt notas.txt

    Creates a symbolic link enlace.txt that points to notas.txt.

  • mklink /D enlace_carpeta C:\Datos

    Creates a symbolic link to the C:\Datos folder.

  • mklink /H copia_dura.txt notas.txt

    Creates a second name for the same content.

  • mklink /J C:\Proyectos D:\Proyectos

    Makes C:\Proyectos lead to D:\Proyectos.

Notes and common mistakes

  • Symbolic links require an administrator console or enabling Windows developer mode.
  • If you delete a symbolic link's target, the link is left broken.

Related commands