


How to create a symbolic link (symlink) in Windows using mklink?
Oct 15, 2025 am 04:21 AMTo create symbolic links in Windows, use the mklink command in an elevated Command Prompt. Use mklink for file links, mklink /D for directory links, mklink /H for hard links, and mklink /J for directory junctions. Administrative privileges are required.
If you want to create a symbolic link in Windows, the mklink command is a powerful tool available in the Command Prompt.
The operating environment of this tutorial: Dell XPS 13, Windows 11
1. Understanding the mklink Command
The mklink command creates symbolic links, hard links, or junctions depending on the switch used. By default, it creates a symbolic link for files unless specified otherwise. Symbolic links act as pointers to another file or directory and behave like the original item.
- Symbolic links can point to files or directories on local or remote volumes
- They are supported starting from Windows Vista and Windows Server 2008
- You must run Command Prompt as Administrator to create symbolic links
2. Open Elevated Command Prompt
To use mklink, administrative privileges are required because creating symbolic links is a system-level operation that could affect file system integrity.
- Press Win S, type "cmd"
- Right-click on "Command Prompt" and select "Run as administrator"
- Confirm the User Account Control (UAC) prompt if shown
3. Create a Symbolic Link for a File
This method creates a symbolic link pointing to a specific file. The link appears as the file itself but references the target location.
- Type the command: mklink link_name target_file_path
- For example:
mklink C:\Links\MyDoc.txt C:\Files\Original.txt
- After execution, accessing MyDoc.txt will transparently open Original.txt
4. Create a Symbolic Link for a Directory
To create a symbolic link pointing to a folder, the /D switch must be used. Without it, mklink attempts to link a file, which will fail if the target is a directory.
- Use the command format: mklink /D link_name target_folder_path
- Example:
mklink /D C:\Project\Assets D:\Media\ProjectAssets
- The linked folder will show the contents of the target directory
5. Create a Hard Link Instead of a Symbolic Link
Hard links directly reference the file's data on disk rather than its path. They cannot span across different volumes and only work with files, not directories.
- Use the /H switch: mklink /H link_name target_file
- Example:
mklink /H C:\Backup\FileCopy.docx C:\Documents\File.docx
- Deleting the original file does not remove the data as long as the hard link exists
6. Create a Directory Junction (Reparse Point)
Directory junctions are similar to symbolic links for folders but are limited to local volume paths. They are more compatible with older applications than symbolic links.
- Use the /J switch: mklink /J junction_name target_directory
- Example:
mklink /J C:\OldPath\Data D:\NewLocation\Data
- Junctions only work with directories and must point to a local path
The above is the detailed content of How to create a symbolic link (symlink) in Windows using mklink?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

ArtGPT
AI image generator for creative art from text prompts.

Stock Market GPT
AI powered investment research for smarter decisions

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Windows 11 can enable the taskbar clock to display seconds through settings, registry, command line, or third-party tools. 1. Turn it on in settings: Go to Personalization → Taskbar → Taskbar Behavior and turn on "Show seconds in system tray clock"; 2. Registry modification: Create a new DWORD value ShowSecondsInSystemClock under HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced and set it to 1; 3. Command line execution: Run PowerShell as an administrator and enter regaddHKCU\Softw

Screen tearing is caused by the graphics card frame rate being out of sync with the monitor refresh rate, which can be solved by enabling windowed optimization, turning off full-screen optimization, setting vertical sync, calibrating the refresh rate, and turning off automatic HDR.

First, use the DISM command to install .NET Framework 3.5 from local sources. If it fails, enable the function through the control panel, then repair the system files and reset the update service, check the group policy settings, and finally use third-party tools to assist in the repair.

1. Quickly switch to compatibility mode by clicking the lightning icon in the address bar; 2. Add specified website rules in the settings to achieve automatic compatibility; 3. Use the Alt T shortcut key to bring up the kernel switching menu; 4. Set global compatibility through desktop shortcut properties.

First, adjust the hardware acceleration settings, close and then restart the Edge browser; second, update or reinstall the graphics card driver to improve compatibility; then clear the GPUCache folder in the ShaderCache; and finally, reset the browser settings to eliminate abnormalities.

First check and enable the "Allow apps to run in the background" function, then restore dynamic updates through settings, reset problem tiles, configure lock screen application permissions, restart Windows Explorer, and use Group Policy to adjust the start screen behavior if necessary to ensure that the tiles are refreshed normally.

Entering safe mode can troubleshoot Windows 10 software or driver problems. Methods include: using system settings, Shift key restart, msconfig tool, forced startup interruption, command prompt to modify startup items, and press F4 or 4 to enter safe mode.

First run SFC and DISM tools to repair system files, then restore the ctfmon.exe startup item through the registry editor or command line, and finally re-register msctf.dll and ctfmon.exe to repair the input method function.
