Purpose:Create or delete an NTFS hard or soft link


Format:Create or update a link:

MKLNK  [/A:[[-]rhsadecijopt]] parm1 [parm2]


Delete a link

MKLNK /D parm1


parm1Name of an existing file (hard link) or directory (for soft link).
parm2Name of the new directory entry (a file or directory reference) to be created.


/A:(Attribute select)
/DDelete a link


See also MKLINK.


File Selection


MKLNK supports the command dialog. For hard links, MKLNK supports attribute switches, extended wildcards, ranges, multiple file names, and include lists. Date, time, size, or file exclusion ranges anywhere on the line apply to all source files. Use wildcards with caution on LFN volumes; see LFN File Searches for details.




MKLNK is obsolete; you should use MKLINK for new scripts.


Due to operating and file system restrictions, this command requires an NTFS volume.


The file/directory names in parm1 and parm2 can be fully or partially qualified, and may contain wildcards (hard links only). MKLINK will also copy an existing description to the link. If you don't specify any arguments, MKLNK will display its command dialog.


If a single argument is specified and it is a junction, MKLNK will display the directory name linked to the junction.


MKLNK sets two internal variables:


%_mklnk_filesThe number of links created
%_mklnk_errors        The number of errors


Hard Links


If parm1 is a file, and parm2 does not exist, MKLNK will create a hard link. If parm2 exists, MKLNK reports an error.


MKLNK (and the underlying Windows API) may fail if the current directory is on a subst or net use drive, or a UNC volume.


Soft Links


If parm1 is a directory, and parm2 does not exist, MKLNK will create a soft link, also known as a "directory junction" or "reparse point". If parm2 exists, and it is a soft link, MKLNK updates it.


A soft link is an indirect or symbolic reference (parm2) to a directory that physically resides in another location (parm1). Note: deleting files from a soft link is equivalent to deleting the files from the original directory.


Note: Other operating systems, such as Linux, may also support "hard links" and "soft links",  but the Windows implementation of these concepts may not behave in the same manner even though the names might be similar.




/=Display the MKLNK command dialog to help you set the filename and command line options. You cannot specify any other arguments on the command line.


/A:Select only those files that have the specified attribute(s) set (hard links only). See Attribute Switches for information on the attributes which can follow /A:.


/DRemove an existing hard or soft link. For hard links, if no more links remain /D will not delete the file.