Windows 10: Create Soft and Hard Symbolic Links in Windows

Discus and support Create Soft and Hard Symbolic Links in Windows in Windows 10 Tutorials to solve the problem; How to: Create Soft and Hard Symbolic Links in Windows How to Create Soft and Hard Symbolic Links in Windows A symbolic link is a file-system... Discussion in 'Windows 10 Tutorials' started by WinClub, Jun 15, 2018.

  1. WinClub New Member

    Create Soft and Hard Symbolic Links in Windows


    How to: Create Soft and Hard Symbolic Links in Windows

    How to Create Soft and Hard Symbolic Links in Windows


    A symbolic link is a file-system object (file or directory) that points to another file system object (file or directory). The object being pointed to is called the target.

    There are two type of symbolic links: hard and soft.

    A soft link is referenced as a symbolic link and works similarly to a standard shortcut. Soft links will have a shortcut arrow icon on them. For example, when you open a soft link to a folder, you will be redirected to the folder where the files are stored.

    A hard link makes it appear as though the file or folder actually exists at the location of the symbolic link, and your app wont know any better. That can make hard symbolic links more useful in most situations. Hard links to a file will not have a shortcut arrow icon on them.

    See also:
    A symbolic link can be helpful if say you wanted to sync a folder for a program. For example, if you have a program that must have its files stored at C:\Program Files and you want them stored at D:\My Location instead. You could move the original directory from C:\Program Files to D:\My Location, and create a symbolic link (soft or hard) at C:\Program Files (link) pointing to D:\My Location (target).

    This tutorial will show you how to create soft and hard symbolic links (symlinks) pointing to a file or folder in Windows 7, Windows 8, and Windows 10.

    *note If you have elevated command prompt.


    CONTENTS:
    • Option One: Create Soft Symbolic Link Pointing to File in Command Prompt
    • Option Two: Create Soft Symbolic Link Pointing to Directory in Command Prompt
    • Option Three: Create Hard Link Pointing to File in Command Prompt
    • Option Four: Create Hard Link (Junction) Pointing to Directory in Command Prompt
    • Option Five: Create Soft Symbolic Link Pointing to File in PowerShell
    • Option Six: Create Soft Symbolic Link Pointing to Directory in PowerShell
    • Option Seven: Create Hard Link Pointing to File in PowerShell
    • Option Eight: Create Hard Link (Junction) Pointing to Directory in PowerShell
    • Option Nine: Delete Hard or Soft Symbolic Link




    OPTION ONE [/i] Create Soft Symbolic Link Pointing to File in Command Prompt
    1. Open an elevated command prompt.

    2. Type the command below into the elevated command prompt, and press Enter. (see screenshot below)
    *Arrow mklink "Link" "Target"

    *note Substitute Link in the command above with the full path with file name and extension you want created as a soft symbolic link at.

    Substitute Target in the command above with the full path of the file with extension that is the target (source) you want the soft symbolic link pointing to.

    For example: mklink "C:\Users\Brink\Desktop\My Documents Link.txt" "C:\Users\Brink\Documents\My Document.txt"

    3. When finished, you can close the elevated command prompt if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION TWO [/i] Create Soft Symbolic Link Pointing to Directory in Command Prompt
    1. Open an elevated command prompt.

    2. Type the command below into the elevated command prompt, and press Enter. (see screenshot below)
    *Arrow mklink /d "Link" "Target"

    *note Substitute Link in the command above with the full path of a folder (directory) you want created as a soft symbolic link at.

    Substitute Target in the command above with the full path of the folder (directory) that is the target (source) you want the soft symbolic link pointing to.

    For example: mklink /d "C:\Program Files\Mozilla Firefox" "D:\Mozilla Firefox"

    3. When finished, you can close the elevated command prompt if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION THREE [/i] Create Hard Link Pointing to File in Command Prompt
    1. Open an elevated command prompt.

    2. Type the command below into the elevated command prompt, and press Enter. (see screenshot below)
    *Arrow mklink /h "Link" "Target"

    *note Substitute Link in the command above with the full path with file name and extension you want created as a hard link at.

    Substitute Target in the command above with the full path of the file with extension that is the target (source) you want the hard link pointing to.

    For example: mklink /h "C:\Users\Brink\Desktop\My Documents Link.txt" "C:\Users\Brink\Documents\My Document.txt"

    3. When finished, you can close the elevated command prompt if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION FOUR [/i] Create Hard Link (Junction) Pointing to Directory in Command Prompt
    1. Open an elevated command prompt.

    2. Type the command below into the elevated command prompt, and press Enter. (see screenshot below)
    *Arrow mklink /j "Link" "Target"

    *note Substitute Link in the command above with the full path of a folder (directory) you want created as a hard link at.

    Substitute Target in the command above with the full path of the folder (directory) that is the target (source) you want the hard link pointing to.

    For example: mklink /j "C:\Program Files\Mozilla Firefox" "D:\Mozilla Firefox"

    3. When finished, you can close the elevated command prompt if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION FIVE [/i] Create Soft Symbolic Link Pointing to File in PowerShell
    1. Open an elevated PowerShell.

    2. Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)
    *Arrow New-Item -ItemType SymbolicLink -Path "Link" -Target "Target"

    *note Substitute Link in the command above with the full path with file name and extension you want created as a soft symbolic link at.

    Substitute Target in the command above with the full path of the file with extension that is the target (source) you want the soft symbolic link pointing to.

    For example: New-Item -ItemType SymbolicLink -Path "C:\Users\Brink\Desktop\My Documents Link.txt" -Target "C:\Users\Brink\Documents\My Document.txt"

    3. When finished, you can close the elevated PowerShell if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION SIX [/i] Create Soft Symbolic Link Pointing to Directory in PowerShell
    1. Open an elevated PowerShell.

    2. Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)
    *Arrow New-Item -ItemType SymbolicLink -Path "Link" -Target "Target"

    *note Substitute Link in the command above with the full path of a folder (directory) you want created as a soft symbolic link at.

    Substitute Target in the command above with the full path of the folder (directory) that is the target (source) you want the soft symbolic link pointing to.

    For example: New-Item -ItemType SymbolicLink -Path "C:\Program Files\Mozilla Firefox" -Target "D:\Mozilla Firefox"

    3. When finished, you can close the elevated PowerShell if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION SEVEN [/i] Create Hard Link Pointing to File in PowerShell
    1. Open an elevated PowerShell.

    2. Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)
    *Arrow New-Item -ItemType HardLink -Path "Link" -Target "Target"

    *note Substitute Link in the command above with the full path with file name and extension you want created as a hard link at.

    Substitute Target in the command above with the full path of the file with extension that is the target (source) you want the hard link pointing to.

    For example: New-Item -ItemType HardLink -Path "C:\Users\Brink\Desktop\My Documents Link.txt" -Target "C:\Users\Brink\Documents\My Document.txt"

    3. When finished, you can close the elevated PowerShell if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION EIGHT [/i] Create Hard Link (Junction) Pointing to Directory in PowerShell
    1. Open an elevated PowerShell.

    2. Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)
    *Arrow New-Item -ItemType Junction -Path "Link" -Target "Target"

    *note Substitute Link in the command above with the full path of a folder (directory) you want created as a hard link at.

    Substitute Target in the command above with the full path of the folder (directory) that is the target (source) you want the hard link pointing to.

    For example: New-Item -ItemType Junction -Path "C:\Program Files\Mozilla Firefox" -Target "D:\Mozilla Firefox"

    3. When finished, you can close the elevated PowerShell if you like.


    Create Soft and Hard Symbolic Links in Windows [​IMG]






    OPTION NINE [/i] Delete Hard or Soft Symbolic Link
    1. Open File Explorer (Windows 8/10) or Windows Explorer (Windows 7).

    2. Navigate to the location of the symbolic link (soft or hard), and delete it. This will not delete the target (source) the symbolic link points to.

    *Warning Do not delete the target (source) the symbolic link points to. You only want to delete the link itself.

    That's it,
    Shawn


    Related Tutorials

    :)
     
    WinClub, Jun 15, 2018
    #1
  2. JayD1 Win User

    Symbolic Links (Soft Links)


    Greetings,


    I have a large number of symbolic links (soft links) on my PC that I want to migrate to a new machine with an identical directory structure. When I use various backup or copy programs that clone files (bit copy), the symbolic links do not work on the target machine (they get converted to empty files instead of links). Any help would be appreciated.
     
    JayD1, Oct 27, 2019
    #2
  3. dalchina Win User
    Symbolic Links (Soft Links)


    Hi, don't know if this is any help:
    Link Shell Extension

    - clearly by someone with a very detailed understanding.
     
    dalchina, Oct 27, 2019
    #3
  4. GDavid Win User

    Create Soft and Hard Symbolic Links in Windows

    Symbolic link (Junction/s), how-to mklink? Please help with Junction?


    Hi all, having been a member at Seven then Ten forums for a fair while I'm hoping to find a straight answer here..? Apologies in advance if this is too verbose.
    Windows 10 system booting from (UEFI) NVME with 2xSSDs + 2 MHDDs for storage...

    An application (Xperia Companion) which will not let me select or personalise the location for saving backups of my cellular phone data...

    Think I found a fair definition of the differences at the Computer hope site which would suggest it's a Junction I need:
    I want Xperia companion to save backups to F:\Sony Backups NOT the default C:\Users\GD\Documents\Sony. Would the Junction (link) allow me to to fulfill my wants and could someone please demonstrate the mklink commands needed?

    with thanks and regards,
    Dave
     
    GDavid, Oct 27, 2019
    #4
  5. ggouki Win User
    mklink /D - symbolic link created but file access is denied via the link

    I have literally the same problem. I could create symbolic links of folders with no problem from a specific disk to another until recently.

    Now symbolic links from that disk to folders on other disks don't work anymore. Access denied.

    Interestingly symbolic links on other disks to folders on other disks work. So do symbolic links on the problematic disk to
    files on other disks - just not symbolic folder links.

    The problem is really just with symbolic folder links on one specific disk.

    The permissions and integrity level of the disk in question are exactly the same as the other disks that don't produce this problem.

    Something is still different with the disk in question. But what could it be ?

    What exactly happens when a symbolic link to a folder (not a file) is created ? And what happens when that folder link is being used to access other folders within the remote location ?

    Cause frankly it is curious that once a folder link is accessed that accessing a folder within that link would produce the error "Location is not available - The system cannot move the file to a different disk drive."

    Why is it trying to move a file to a different drive ? After all I'm just listing folder contents.

    Mind you the symbolic link to the folder on another disk lets me access the folder (list its contents), but i cannot access the files within the folder or even open other folders within the link.
     
    ggouki, Oct 27, 2019
    #5
  6. Ferdz Amp Win User
    Stranded folder/broken link

    Hi Ken,

    This could be a symbolic link set by the script that you mentioned. The steps required in deleting the symbolic links depends on the type of symbolic function used to create it. You might need to check the actual script or contact the provider of the script
    on what function was used.

    Additionally, you can check out the following documentations regarding symbolic links:


    Let me know how it goes.
     
    Ferdz Amp, Oct 27, 2019
    #6
Thema:

Create Soft and Hard Symbolic Links in Windows

Loading...
  1. Create Soft and Hard Symbolic Links in Windows - Similar Threads - Create Soft Hard

  2. Cannot create symbolic link on Windows 11 with Powershell 7 - CommandNotFoundException

    in Windows 10 Gaming
    Cannot create symbolic link on Windows 11 with Powershell 7 - CommandNotFoundException: I installed Powershell 7 and was trying to mklink /D \kang C:\Users\Me\Documents\Learn\Java\Sandbox\src\mammal\kangaroo mklink : The term 'mklink' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a...
  3. Cannot create symbolic link on Windows 11 with Powershell 7 - CommandNotFoundException

    in Windows 10 Software and Apps
    Cannot create symbolic link on Windows 11 with Powershell 7 - CommandNotFoundException: I installed Powershell 7 and was trying to mklink /D \kang C:\Users\Me\Documents\Learn\Java\Sandbox\src\mammal\kangaroo mklink : The term 'mklink' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a...
  4. Symbolic links/Folder links

    in Windows 10 Network and Sharing
    Symbolic links/Folder links: Apologies for the long introcution first; I have read a number of questions and answers relating to symbolic links with interest, and have noted that del, rmdir mklink, file explorer are all dangerous tools to use in order to remove a symbolic link. I had a PC with several...
  5. Symbolic links/Folder links

    in Windows 10 Gaming
    Symbolic links/Folder links: Apologies for the long introcution first; I have read a number of questions and answers relating to symbolic links with interest, and have noted that del, rmdir mklink, file explorer are all dangerous tools to use in order to remove a symbolic link. I had a PC with several...
  6. Symbolic links/Folder links

    in Windows 10 Software and Apps
    Symbolic links/Folder links: Apologies for the long introcution first; I have read a number of questions and answers relating to symbolic links with interest, and have noted that del, rmdir mklink, file explorer are all dangerous tools to use in order to remove a symbolic link. I had a PC with several...
  7. Symbolic link deletion

    in Windows 10 Updates and Activation
    Symbolic link deletion: Hello,I am having an issue. When I have tried to remove symlink using commands del, mkdir, unlink etc, they not helped to unlink. Either access is denied or file is not ok. I can't create and create a new symlink....
  8. Creating a symbolic link on Windows 10 for iTunes iPhone backup

    in Windows 10 Network and Sharing
    Creating a symbolic link on Windows 10 for iTunes iPhone backup: Hello all, I have a question that I have been having a hard time finding an answer for by just searching the web. I am trying to create an mklink for my iTunes backup directory so that I can store my iPhone backups on my much larger HDD d: drive rather than my SSD c: drive....
  9. No Thumbnails on Photos in Folders Created as Symbolic Links to UNC Paths

    in Windows 10 Network and Sharing
    No Thumbnails on Photos in Folders Created as Symbolic Links to UNC Paths: My previous post on this problem was locked without reason. This is the same problem as described in https://answers.microsoft.com/en-us/windows/forum/windows_8-files/no-thumbnails-on-symbolic-link-network-paths/8e9497d5-ef71-429d-b8ca-cf74672dc8f5 but for Windows 10. I...
  10. Symbolic Links (Soft Links)

    in Windows 10 Support
    Symbolic Links (Soft Links): Greetings, I have a large number of symbolic links (soft links) on my PC that I want to migrate to a new machine with an identical directory structure. When I use various backup or copy programs that clone files (bit copy), the symbolic links do not work on the target...