The Wayback Machine - https://web.archive.org/web/20241008160041/https://www.geeksforgeeks.org/creating-symbolic-links-on-windows/
Open In App

Creating Symbolic Links on Windows

Last Updated : 08 Sep, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

A symbolic link is used to describe a file, that doesn’t store any data. Symbolic Links on Windows contains a reference to another file or directory in the respective of an absolute or you can say to the relative path. The type of path (relative/absolute) is defined during the creation of the link. 

Most operating systems offer support for Symbolic Links in one way or another. Linux and Windows both provide support for generic Symbolic Links with some OS exclusive features, i.e. Windows allows for the creation of Junction points which are folder soft links with a little different working. In this article, we will take a look at the creation of symbolic links on Windows using mklink command found in the command processor (cmd) of the OS. 

Note –

The command requires administrator privileges to execute.

Types of symlinks : 

Description of the command : 

MKLINK [[/D] | [/H] | [/J]] Link Target

       /D      Creates a directory symbolic link.  Default is a file
               symbolic link.
       /H      Creates a hard link instead of a symbolic link.
       /J      Creates a Directory Junction.
       Link    Specifies the new symbolic link name.
       Target  Specifies the path (relative or absolute) that the new link
               refers to.

Note –

The above text could be obtained by executing the mklink command without any arguments.

Creating a soft link to a file :

In order to create a soft link, the syntax of the command is:

mklink Link_path Target_path
  • Where Link_path is the name (or path) to the symbolic link which is to be created. 
  • Target_path is the path which the new link will refer to.

Example –

There exists the a file with the path C:\suga\settings

In order to create a soft link of the file on the same path with a different name (ex. apple), the command would look as follows.

mklink  "C:\suga\apple" "C:\suga\settings" 

Note –

In the above command, both paths are absolute.

After the execution of the above command, a soft link to the file will be created appears as follows.

The same method could be used for creating a soft link to a directory as well, the only difference being that the /D switch needs to be added to the command.

making the syntax :

mklink /D Link_path Target_path

Creating a hard link to a file :

In order to create a soft link, the syntax of the command is as follows.

mklink /H Link_path Target_path

Example –

In this example, we would use the same file as the one used in the last example, located at  C:\suga\settings. In order to create a hard link of the file at the same path with a different name (ex. moba) the command would look as follows:

mklink /H "C:\suga\moba" "C:\suga\settings" 

After the execution of the above command, a hard link to the file will be created appearing as follows :

Hard links could not be created for directories, therefore unlike the previous example, both paths (Link & Target) should point to a file only.



Similar Reads

Explain Why Windows 32-bit called Windows x86 and not Windows x32
Before diving further into it, Let's start with a quick definition of a bit :In binary - a bit is a single character that can be either 1 or 0.We can represent up to four values using two bits, with 3 bits that go up to 8 values. The amount of different values we can express in binary grows exponentially with each bit we add.Now, we'll understand w
3 min read
Creating sparse files on Windows/ Linux
Sparse file is a type of computer file, which generally has file size (logical) higher than allocated size (clusters allocated to data of the file). Most File systems support this type of file, but Operating system suppresses them underneath command interpreters' command or API calls. Therefore, these could not be accessed using generic copy/paste/
2 min read
Creating and Running a Fedora Linux Live USB stick on a PC with Windows 11
This article presents a brief overview of the Fedora operating system, describes what live boot is, and then shows how to create a live bootable USB drive and then run a live version of the operating system on a PC with Windows 11 (Home). Overview of FedoraFedora Linux is a popular free and open-source operating system (Linux distribution) develope
6 min read
Difference Between Windows 11 and Windows 10
In this article, we are going to discuss the difference between Windows 11 and Windows 10. Windows 10 Windows 10 is the last generation of Windows which was launched on July 15, 2015, after the Windows 8.1 version. Windows 10 introduced a completely new browser by Microsoft called Microsoft Edge. Windows 10 was mainly designed by also keeping in mi
6 min read
How to disable superfetch in windows 10 or windows 11?
Windows Vista introduced the Superfetch (SysMain) capability, which is still a part of the Windows operating system. It is a built-in service designed to speed up startup times and enhance performance by preloading frequently used apps in RAM. It was, however, primarily developed for older PCs. For contemporary PCs running Windows 10 and Windows 11
4 min read
Creating Junction Points
Junction Points (also commonly referred to as NTFS Junction or Directory Junction) is a type of reparse point which contains a link to a directory that acts as an alias of that directory. Junction points are a Windows exclusive feature, absent in other operating systems. Compatibility with Legacy Windows OS and less privilege requirement makes Junc
2 min read
Difference between DOS and Windows
DOS and Windows square measure the various varieties of Operating Systems. DOS stands for Disk Operating System. It is a smaller amount probably employed in the current state of affairs whereas windows may be a wide used in operation system. It consumes less memory and power than windows. Features of DOS: Command Line Interface: DOS is primarily a
4 min read
Compare file system in Windows and Linux
File System in Linux : Linux supports more than 12 file systems with NFS technology. When Linux (that is, operating system code) is linked, the default file system option needs to be specified. other file systems can be called dynamically depending on requirements. Ext file system is the most popular option. It is similar to the Berkeley file syste
3 min read
How to disable Windows Startup services?
Startup services in Windows are the programs or application which starts automatically when the system started. These contain some of the essential services that are needed to be run automatically after the system started. These services run in the background to ensure the proper functionality of the system. When the automatic startup of these prog
2 min read
Interesting Facts about WINDOWS
Microsoft Windows commonly known as Windows, was introduced by Microsoft on 20 November, 1985. Windows is proprietary and closed source operating system. Windows uses Graphical User Interface (GUI) to interact with users. Bill Gates and Paul Allen founded Microsoft and Windows operating system. Windows is supported on almost every computer platform
3 min read
Difference between Windows and AIX
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and FreeBSD
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and Android
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
4 min read
Difference between Windows and Chrome OS
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and iOS
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and Haiku
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and Genode
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and AmigaOS 4
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and IBM i
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and HP-UX
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and GhostBSD
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and DragonFly BSD
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and MINIX 3
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and OpenBSD
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and NetBSD
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
3 min read
Difference between Windows and Inferno
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and Solaris
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and QNX
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and Plan 9
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Difference between Windows and OS/2
1. Windows : Windows is a group of various proprietary graphical operating systems which is provided by Microsoft Incorporation. It is also known as Microsoft Windows. It currently includes Windows NT and Windows IoT as members of its family. Earlier it included Windows 9x, Windows Mobile and Windows Phone which are no longer in use. It is the most
2 min read
Article Tags :