I created a symlink using mklink. Now I need to change it but I can't figure out how to delete it so I can recreate it correctly.

link|improve this question
feedback

4 Answers

up vote 4 down vote accepted

MKLINK cannot be used to delete symbolic links. To remove a symbolic link, simply delete them as if you’re removing a normal file. For example, to delete the foo symbolic link created above, enter the following command:

C:\test>del foo

source: http://www.mydigitallife.info/2007/05/22/create-symbolic-links-hard-links-and-directory-junctions-in-vista-with-mklink/

link|improve this answer
Ah, thanks, I was making it too hard. Eight more minutes till I can accept your answer. – Ben V Jul 23 '10 at 23:28
1  
Just make sure you don't delete it with del /S or Explorer. – Hello71 Jul 24 '10 at 0:12
See eddyq's answer below because using del for a link made to a directory won't work and instead will attempt to delete teh contents of the folder. – jpierson May 7 at 13:48
feedback

Be very careful.

If you have a symbolic link that is a directory (made with mklink /d) then using del will delete all of the files in the target directory (the directory that the link points to), rather than just the link.

rmdir on the other hand will only delete the directory link, not what the link points to.

link|improve this answer
2  
Having just accidentally done this (deleted the complete contents of the target folder), this an important tip. – Simon Gillbee Aug 8 '11 at 21:10
1  
F**k! Me too... God bless backups... We should upvote this to "outvote" the accepted answer :) – jitbit Mar 15 at 10:56
feedback

For a symlink to a file, use del. For a symlink to a directory made with mklink /d, use rmdir.

link|improve this answer
feedback

To remove directory symbolic links created with mklink /d it is safe to just delete the symbolic link in explorer.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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