25

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

ln -f
13

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:

  • This solution seems to work however I didn't test it thoroughly. – Eugeniu Torica Jul 23 '12 at 9:32
  • wow! Link Shell Extension, also notably, includes a Symbolic Link Driver for Windows XP among it's downloads. – n611x007 Mar 27 '13 at 11:50
  • mklink would be the Windows-integrated command for linking (symbolic and hard). – Jinxed Feb 28 '16 at 22:08
  • @Jinxed, I already said that mklink doesn't do what the OP asked. – Julian Knight Feb 29 '16 at 22:36
  • 1
    The windows Methodology for changing the location of a softlink using MKLINK is to delete the link (Using RD /Q if a directory link, or Del /F /Q if a file link) and recreate it uisang MKLINK. eg RD /Q "C:\Link\Folder" && MKLINK /D "C:\Link\Folder" "C:\Some\New\Target\Folder" and Del /F /Q "C:\Link\File Link" && MKLINK "C:\Link\File Link.ext" "C:\Some\New\Target\File here.ext" This is also True for Junctions and Hard Links. – Ben Personick May 14 '19 at 15:33
3

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

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

0

The method belo works for me in Windows 7

mklink TempLink NewTarget

copy /l /y TempLink OldLink

del TempLink

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.