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

Solution 1:

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:

  • http://unxutils.sourceforge.net/
  • http://schinagl.priv.at/nt/ln/ln.html
  • http://neosmart.net/Symlinks/
  • http://www.mkssoftware.com/

Solution 2:

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

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

Solution 3:

The method belo works for me in Windows 7

mklink TempLink NewTarget

copy /l /y TempLink OldLink

del TempLink