This function allows you to create a symbolic link for either a directory or a file using PowerShell. This does not use mklink.exe, which is an internal command available with cmd.exe and instead uses pinvoke to call Win32 APIs to handle the symbolic link creation.

Updated 23 July 2014

Related blog post: http://learn-powershell.net/2013/07/16/creating-a-symbolic-link-using-powershell/

As always, be sure to dot source this script to load the function into memory before using it.

 

PowerShell
Edit|Remove
New-SymLink.ps1
 

 

Create a symbolic link to a directory

 

 

 

 

 

 

PowerShell
Edit|Remove
New-SymLink -Path "C:\users\admin\downloads" -SymName "C:\users\admin\desktop\downloads" -Directory