How do I convert a file path with a symbolic link to the original real path?
Hi,
I created a symbolic link with the mklink command in Windows 7.
For example:
mklink /d c:\linkDir c:\realDir
Is there a command that will return the path c:\realDir if I pass in the path with the symbolic link (c:\linkDir)?
In python, there's a command called os.path.realpath(path). Unfortunately, Windows' symbolic links aren't recognized by Python versions older than 2.7; we're on 2.6.4. Is there an equivalent command in Windows 7?
Thanks.
June 20th, 2012 2:30pm
Hi,
MKLINK cannot use to delete symbolic link. To remove a symbolic link, simply delete them as if youre removing a normal file. Just make sure you dont delete the original file.Juke Chou
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2012 2:12am
Hi,
MKLINK cannot use to delete symbolic link. To remove a symbolic link, simply delete them as if youre removing a normal file. Just make sure you dont delete the original file.Juke Chou
TechNet Community Support
June 22nd, 2012 2:12am
Thanks for the reply!
Is there a way to query if a path has a symbolic link included in it? I would like to avoid having to traverse up each subdir in the path and parsing the command line windows output.
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2012 3:35pm
At the command line, do a DIR /A. The symbolic links will show the real path.
Volume in drive C is Windows 8 Release Preview
Volume Serial Number is 8604-71E1
Directory of C:\Temp
06/23/2012 04:12 PM <DIR> .
06/23/2012 04:12 PM <DIR> ..
06/23/2012 04:12 PM <SYMLINKD> linkDir [c:\Temp\realDir]
06/23/2012 04:11 PM <DIR> realDir
0 File(s) 0 bytes
4 Dir(s) 311,193,092,096 bytes free
June 23rd, 2012 4:13pm
At the command line, do a DIR /A. The symbolic links will show the real path.
Volume in drive C is Windows 8 Release Preview
Volume Serial Number is 8604-71E1
Directory of C:\Temp
06/23/2012 04:12 PM <DIR> .
06/23/2012 04:12 PM <DIR> ..
06/23/2012 04:12 PM <SYMLINKD> linkDir [c:\Temp\realDir]
06/23/2012 04:11 PM <DIR> realDir
0 File(s) 0 bytes
4 Dir(s) 311,193,092,096 bytes free
Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2012 4:13pm