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. Does creating a hard link just make a copy??

    in Windows 10 Ask Insider
    Does creating a hard link just make a copy??: Okay, say I have file "original.ext", and a hard link "hardlink.ext" which hard links to "original.ext". When I delete "original.ext", "hardlink.ext" still opens just fine. What's going on here? I thought a hard link is supposed to just point to the target? If the target is...
  3. Need help with symbolic links

    in Windows 10 Support
    Need help with symbolic links: Windows 10, build 19041.329 I am trying to set up a computer with Windows 10. The problem I am having is this: After I installed Windows 10, I then followed the advice given here, How to move user folders to different location on Windows 10 | Windows Central, to move all of...
  4. 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....
  5. 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...
  6. No Thumbnails on Symbolic Links to Network Paths

    in Windows 10 Network and Sharing
    No Thumbnails on Symbolic Links to Network Paths: 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 have a NAS box \\DSxxx where I have a shared folder at...
  7. Symbolic links inside linked folder

    in Windows 10 Network and Sharing
    Symbolic links inside linked folder: Hi I'm creating symbolic links of one folder (Missions folder) to server so that the server can load the missions from the linked folder and this works. But the problem is that when I create symbolic links inside the sub folders (of Missions folder) then the server fails to...
  8. Any security risks with granting everyone permissions to create symbolic links?

    in AntiVirus, Firewalls and System Security
    Any security risks with granting everyone permissions to create symbolic links?: Why is the ability to create symlinks in windows restricted to administrators? And are there any security risks in granting that permissions to all users?...
  9. 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...
  10. Exclude folder form Symbolic link ?

    in Windows 10 Support
    Exclude folder form Symbolic link ?: Can I use Xcopy / Robocopy to create not only a symbolic link but exclude a folder from the symbolic link creation ? 80242