How do I change target of symlink in windows

Is it possible to change the target of a symlink or junction in Windows? In Linux it can be modified with:

ln -f

5 Answers

With Windows Link Shell Extension installed, you can right-click on the link in Windows Explorer and check the properties. There is a tab that allows you to change the link directly.

Sorry I can't say if this is possible without the extension installed as it is one of the first things I install after Windows.

The Windows command link tool mklink does not allow this.

There are, however, Windows equivalents for Linux commands. ln.exe is one:

5

Just remove and recreate the link. That's all that -f does in Linux anyway.

Also, here's a cool Windows Link Shell Extension.

The method belo works for me in Windows 7

mklink TempLink NewTarget
copy /l /y TempLink OldLink
del TempLink
1

Powershell

New-Item -Type SymbolicLink -Path "C:\linkpath" -Target "C:\newtarget" -Force

Mind the -Force Luke

P.S. elevated mode required

Note that if the symlink is a hanging symlink, i.e. points to a nonexistent location, then using linkshell extension will not allow you to edit the target, because this works as an extension to explorer which adds a tab to the properties context menu. If the symlink is hanging, explorer signals an error and will not allow you to access the link properties, and hence you will not be able to edit the target location.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like