I made some symlinks in MS Windows using mklink /D
command.
But when copy it, Windows Explorer always perform deep copy instead copying symlink itself.
How can I just copy the link? I need to send these links to other users on other machine.
-
I've downvoted the OP to reconsider the correct answer again, and because there are other answers on SU.– M. A.Commented Dec 14, 2019 at 10:15
-
@M.A. I deselected the answer and I cannot chose one now as I cannot test answers below anymore. Let's see which one to be chosen by community!– EonilCommented Jan 8, 2021 at 4:09
-
Does this answer your question? Windows 7 / Symlinks - How do I copy a Symlink to a directory?– BasjCommented Feb 2, 2021 at 9:05
5 Answers
A tool answer: LinkShellExtension allows you to do this and much more. If you're working with soft/hard links in Windows at all, it's an enormously helpful tool.
In this case, you probably want to choose its 'Splice' behaviour in copying Symlinks.
-
1For other readers, complete instructions can be found here (tested and confirmed working): superuser.com/a/1509670/231129– VenryxCommented Dec 13, 2019 at 1:41
partially duplicate question, multiple good answers are here
Using Windows tool
xcopy /b /i <source symlink name> <destination symlink name>
and you should disregard a message:
output is 0 File(s) copied
also another tool in standard Windows installation: robocopy
/SL :: copy symbolic links versus the target.
Since you mentioned you want to "send" it, you might get TAR which can pack/unpack symlinks into one archive file. 7z might one day too.
As I see it, 7zip can archive them but not extract on Windows.
The symlink to a directory acts as a directory itself. So, when you copy the directory, you copy the directory.
If you had a directory with a bunch of files in it and you wanted a copy of it, but without the files in it, you'd just make a new directory with the same name. Same thing applies here, really.
The answer is as simple as that: You cannot. Instead, run the same command on the other machine.
-
5
-
-
This is correct in the context of using Windows Explorer, as mentioned by OP. Indeed, it seems to be impossible with the Windows Explorer GUI. With command-line, it is possible with
xcopy
as mentioned by @AntonKrouglov.– BasjCommented Jan 7, 2021 at 8:21
Just drag and drop the symlinks between one explorer window to their destination in another. It will move them without copy the contents.