This issue appeared during the following operation. First, a PowerShell script was used to create a symbolic link:
New-Item -ItemType SymbolicLink -Path d:\share_folder\ -Name latest -Target d:\share_folder\v1000 -Force
This command creates a shortcut named ‘latest’ inside d:\share_folder, pointing to the sibling folder v1000. Then share_folder was shared over the network. When accessing \\xxx.xxx.xxx.xxx\share_folder\latest from another machine, the error appeared: ‘Cannot follow symbolic link because its type is disabled’. Searching online revealed the reason, for example: https://www.zywvvd.com/notes/system/windows/symlink-disabled/symlink-disabled/
By default, Windows only allows symbolic link following locally. Remote‑to‑local (a shortcut inside a share pointing to a local path) and remote‑to‑remote (a shortcut inside a share pointing to another share path) are disabled. Following the solution, running: fsutil behavior set SymlinkEvaluation R2L:1 enables remote‑to‑local following. But then accessing the link produced ‘target folder does not exist’.
The reason is that Windows does not automatically assume the shortcut inside the share points to the host’s local folder. Instead, it tries to resolve the path on the client machine, so the folder is not found. This explains why remote symlink following is disabled by default.
On Linux, SMB shares handle this correctly: a symlink created with ln is resolved by the server, and Windows clients see the correct target. But Windows does not behave this way. The workaround was:
On the client machine, enable R2R following (similar command with different parameter). Then, when creating the shortcut on the server, set the target to the shared path instead of the local path:
New-Item -ItemType SymbolicLink -Path d:\share_folder\ -Name latest -Target \\192.168.0.10\share_folder\v1000 -Force
To avoid DHCP IP changes, use the hostname instead of the IP. With the client settings adjusted, this shortcut works correctly when accessed from clients, and also works on the server. Compared to Linux + SMB it feels less natural, but it achieves the goal.
博主友情提示:
如您在评论中需要提及如QQ号、电子邮件地址或其他隐私敏感信息,欢迎使用>>博主专用加密工具v3<<处理后发布,原文只有博主可以看到。