- Instant help with your Developer coding problems

Create symbolic link in Windows 11

Question:
How to create symbolic link in Windows 11?
Answer:
# In Command Prompt as Administrator
mklink /D "D:\Projects\NewFolderName" "C:\Users\Mike\Work\ExistingTestProject"

# In PowerShell as Administrator
New-Item -ItemType SymbolicLink -Path "D:\Projects\NewFolderName" -Target "C:\Users\Mike\Work\ExistingTestProject"
Description:

Although symbolic links are not as common on Windows systems as they are on Linux or OSX, they can be useful in many cases. For example, if you want to access your files and folders more easily, or if you don't have enough space on your C drive, but a program wants to store your data there.

Currently, you can create symbolic links with two commands. You can use Command Prompt or PowerShell. It is essential that whether you use CMD or PowerShell, you always start it with Administrator privileges.

Command Prompt:

mklink /D "D:\Projects\NewFolderName" "C:\Users\Mike\Work\ExistingTestProject"

The first path is the one you want to create. It mustn't exist yet, otherwise, you will get an error. The second path parameter is the directory, that already exists, where the previous path points to.

PowerShell:

New-Item -ItemType SymbolicLink -Path "D:\Projects\NewFolderName" -Target "C:\Users\Mike\Work\ExistingTestProject"

You can specify the directory you want to create in the -Path parameter. It mustn't already exist, otherwise, you will get an error. The -Target parameter is the directory that already exists, where the previous path points to.

Share "How to create symbolic link in Windows 11?"
Tags:
create, symbolic, link, cmd, command prompt, mklink, powershell, new-item, example
Technical term:
Create symbolic link in Windows 11