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. 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...
  3. 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?...
  4. email creates link to photos

    in Windows 10 Customization
    email creates link to photos: Whenever I send an email and attach a photo, the receiver also gets a link attached saying see all photos which enables them to view all my photos How do I stop the link being sent?...
  5. Are symbolic links available to sync PC to Onedrive?

    in Windows 10 Customization
    Are symbolic links available to sync PC to Onedrive?: I used to use symbolic links to sync files on my PC to OneDrive. But these symbolic links stopped working a while ago. So I do a query, are they available?...
  6. Word does not want to save to a symbolic link directory

    in Windows 10 Network and Sharing
    Word does not want to save to a symbolic link directory: Hi there, I have opened a file from a symbolic link folder (File is located on another computer in a folder that has been linked as a symbolic link on my computer) When I try to do Save As under a different name on the same folder I get "A file error has occurred" error. If...
  7. Windows Accessories - Using Xcopy breaks folder symbolic link

    in Windows 10 Support
    Windows Accessories - Using Xcopy breaks folder symbolic link: Hi Guys I'm using XCOPY to move some icons into the 'Windows Accessories' folder. The 'Windows Accessories' folder true file location is: C:\Users\UserXYZ\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories AND C:\ProgramData\Microsoft\Windows\Start...
  8. Can I replace an entire drive with a symbolic link?

    in Windows 10 Support
    Can I replace an entire drive with a symbolic link?: I try to use the same basic structure on all my computers: drive C for Windows, D for games, E for user data, F for bulk storage. On my laptop (which is very much my secondary machine and rarely used) I typically split the single HDD into these four parts, but I figure that's...
  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