WAD MKLINK File symlinks are absolute

Oct 29, 2008
88
0
MKLINK is creating absolute file symlinks when /a is not used.

Code:
56.6G C:\tmp1> touch /c foo
2011-12-30 16:21:50.287  C:\tmp1\foo

56.6G C:\tmp1> mklink bar foo
Symbolic link created for bar <<===>> C:\tmp1\foo

56.6G C:\tmp1> dir

 Volume in drive C is OS             Serial number is 32f0:9b4c
 Directory of  C:\tmp1\*

2011-12-30  16:21         <DIR>    .
2011-12-30  16:21         <DIR>    ..
2011-12-30  16:21     <SYMLINK>    bar [C:\tmp1\foo]
2011-12-30  16:21               0  foo
                 0 bytes in 2 files and 2 dirs
    60,780,445,696 bytes free
 
Oct 29, 2008
88
0
Yes. If you, for example, move tmp1 to D:, it would be nice if bar was still pointing at foo, rather than at a nonexistent file in a nonexistent directory. This is also a cmd compatibility issue:
Code:
C:\Users\johnb\tmp0> echo.>foo
 
C:\tmp0> mklink bar foo
symbolic link created for bar <<===>> foo
 
C:\tmp0> dir
Volume in drive C is OS
Volume Serial Number is 32F0-9B4C
 
Directory of C:\tmp0
 
2011-12-30  19:25    <DIR>          .
2011-12-30  19:25    <DIR>          ..
2011-12-30  19:25    <SYMLINK>      bar [foo]
2011-12-30  19:24                2 foo
              2 File(s)              2 bytes
              2 Dir(s)  59,592,462,336 bytes free
I can use Hermann Schinagl’s ln.exe to do it if you really object to adding it, but then I have to think about it because that command has the link and target in opposite order.
 
May 31, 2008
382
2
Are you sure that Windows will actually move a relative link to another disk?
Don't know about another disk, but CMD does move a relative file symlink (with a non-existent target) to another folder.
Code:
[C:\test]cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2010 Microsoft Corporation. All rights reserved.
 
C:\test>mkdir dA
 
C:\test>mklink dA\linkB B
symbolic link created for dA\linkB <<===>> B
 
C:\test>dir /S
 
Directory of C:\test
 
01/01/2012 09:51 AM <DIR> dA
0 File(s) 0 bytes
 
Directory of C:\test\dA
 
01/01/2012 09:51 AM <SYMLINK> linkB [B]
1 File(s) 0 bytes
 
Total Files Listed:
1 File(s) 0 bytes
5 Dir(s) 71,142,207,488 bytes free
 
C:\test>move dA dB
1 dir(s) moved.
 
C:\test>dir /S
 
Directory of C:\test
 
01/01/2012 09:51 AM <DIR> dB
0 File(s) 0 bytes
 
Directory of C:\test\dB
 
01/01/2012 09:51 AM <SYMLINK> linkB [B]
1 File(s) 0 bytes
 
Total Files Listed:
1 File(s) 0 bytes
5 Dir(s) 71,142,207,488 bytes free
 
C:\test>echo text >dB\B
 
C:\test>type dB\linkB
text
 
Oct 29, 2008
88
0
Windows will not move a directory containing relative symlinks without help (they are converted to files). However, consider where the symlink is on an NTFS-formatted external drive that is E: on one machine but D: on another.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Windows will not move a directory containing relative symlinks without help (they are converted to files). However, consider where the symlink is on an NTFS-formatted external drive that is E: on one machine but D: on another.
Or it can be C: (internal) on its own system, but mapped to another letter on another system (Z: is the first choice). Only relative links are mappable. It is one of the reasons I am considering upgrading to Win7.
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly MKLINK and Streams and DEL Support 4
B MKLINK requires admin - fails silently. Support 1
Stefano Piccardi Issue: MKLINK /J creates invalid link [TCC 14.03.53] Support 4
Stefano Piccardi Fixed mklink /X junction\ Support 3
samintz Fixed GPF from MKLINK Support 1
fpefpe Fixed MKLINK Support 2
J WAD MKLINK & XP Support 4
Stefano Piccardi WAD MKLINK CMD compatibility, MKLINK /X Support 6
Stefano Piccardi Fixed MKLINK /D Support 4
Stefano Piccardi 13.0.31 2 MKLINK TCC vs CMD issues Support 2
David McClelland MKLINK /x discrepancy Support 0
R No Error Message when running mklink as limited user Support 3
W mklink and Volume Shadow Copies Support 5
N mklnk / mklink problem Support 7
J History file load hangs if file has complete garbage in it... Support 1
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
thorntonpg file explorer - short cut keys Support 1
JohnQSmith New online help file wrong logo Support 7
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
samintz How to? swap endianness in a binary file Support 12
vefatica `Back quotes` - command line vs. batch file Support 5
fpefpe How to? batch file size Support 2
Jay Sage Issues With TCMD File Explorer Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
Joe Caverly @FILESIZE and NTFS File Stream Support 1
Joe Caverly Embedding an .EXE (or other file) into a .BTM Support 8
U Command help on file names Support 5
S Concatenate all playlists into 1 file Support 22
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
Joe Caverly Rename file that begins with Emoji Support 7
Joe Caverly PSHELL and NTFS File Streams Support 2
P Kill all other instances of tcc from a btm batch file Support 2
D ffind hangs on large file Support 18
Alpengreis Documentation Minor issue in help file for view /E Support 1
fpefpe batch file ending early Support 18
J Licesne file location Support 1
K robocopy cancelling batch file processing Support 28
Jay Sage TCMD Crashes with "tctoolbar /c /r file" Support 5
A Unable to pass batch file arguments unaltered Support 18
MikeBaas How to...extract a string from a .json-file? Support 10
vefatica LIBRARY and file name completion? Support 4
D What does the file "..\Everything\Run history.csv" store? Support 5
H Takecommand.pdf failed not a pdf file Support 6
Joe Caverly DIRectory Colorization in v25 Help File Support 0
C show file description? with dir? Support 8
D When copying/moving, appending " (2)" to filename when the target file already exist. Support 7
R How to? Dir specific file search patterns with spaces in the pathnames? Support 6
Joe Caverly _EXPANSION in help file Support 0
Stefan Hassel Installation file TC 24.02 Build 47 is actually version 25.00.1 Support 10
vefatica Are @FILEDATE[file] and @FILEDATE[file,u] ever different? Support 2

Similar threads