Welcome to MSDN Blogs Sign in | Join | Help

Symbolic link in Windows Vista

You can create symbolic link in Windows Vista now.

C:\test>ver

Microsoft Windows [Version 6.0.5365]

C:\test>mklink
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

C:\test>mklink foo c:\Windows\system32\notepad.exe
symbolic link created for foo <<===>> c:\Windows\system32\notepad.exe

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 2211-7428

 Directory of C:\test

04/14/2006  11:24 AM    <DIR>          .
04/14/2006  11:24 AM    <DIR>          ..
04/14/2006  11:24 AM    <SYMLINK>      foo [c:\Windows\system32\notepad.exe]
               1 File(s)              0 bytes
               2 Dir(s)  69,238,722,560 bytes free

C:\test>mklink /d bar c:\windows
symbolic link created for bar <<===>> c:\windows

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 2211-7428

 Directory of C:\test

04/14/2006  11:24 AM    <DIR>          .
04/14/2006  11:24 AM    <DIR>          ..
04/14/2006  11:24 AM    <SYMLINKD>     bar [c:\windows]
04/14/2006  11:24 AM    <SYMLINK>      foo [c:\Windows\system32\notepad.exe]
               1 File(s)              0 bytes
               3 Dir(s)  69,238,722,560 bytes free

C:\test>del foo

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 2211-7428

 Directory of C:\test

04/14/2006  11:24 AM    <DIR>          .
04/14/2006  11:24 AM    <DIR>          ..
04/14/2006  11:24 AM    <SYMLINKD>     bar [c:\windows]
               0 File(s)              0 bytes
               3 Dir(s)  69,238,722,560 bytes free

C:\test>rd bar

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 2211-7428

 Directory of C:\test

04/14/2006  11:24 AM    <DIR>          .
04/14/2006  11:24 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  69,238,722,560 bytes free

(By default only administrators can create symbolic link. You can override the decision using secpol.msc.)

Documentation of symbolic link can be found in MSDN

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/symbolic_links.asp

Published Saturday, April 15, 2006 8:00 AM by junfeng
Filed under:

Comments

# re: Symbolic link in Windows Vista

Saturday, April 15, 2006 11:54 AM by Mike
Why admin only by default?

# Finally!

Saturday, April 15, 2006 1:16 PM by Uwe Keim
Really great news!

# re: Symbolic link in Windows Vista

Saturday, April 15, 2006 2:15 PM by Maciej Rutkowski
It's the same as creating junctions in any other NTFS 5.0 volume with sysinternals or Win 2003 resource kit tools, isn't it?

# re: Symbolic link in Windows Vista

Saturday, April 15, 2006 2:18 PM by Maciej Rutkowski
Err, ok, on second thought - it must be a hybrid of some kind since the junctions work only for directories. Sorry for the fuss. ;)

# re: Symbolic link in Windows Vista

Saturday, April 15, 2006 10:56 PM by Josh Einstein
How is this different than hardlinks in XP.

fsutil

Can it span volumes?

# re: Symbolic link in Windows Vista

Sunday, April 16, 2006 5:11 PM by junfeng
It is the same as hardlink vs symlink in Unix.

I believe it can span volumes, as I can create a symlink to an UNC path.

# re: Symbolic link in Windows Vista

Sunday, April 16, 2006 11:20 PM by Norman Diamond
> /D Creates a directory symbolic link.
> Default is a file symbolic link.

Why doesn't the default depend on the kind of object being linked to?

What happens if the person creates a directory symbolic link to a file, or a file symbolic link to a directory?

And I wonder the same thing as Mike.  If you don't let ordinary users create links in their directories under \Documents and Settings or \Users because the links might point to \Windows\System32, well then, ordinary users will still have to type \Windows\System32 at the command line.  This inconveniences them but doesn't add security.

# re: Symbolic link in Windows Vista

Monday, April 17, 2006 12:55 AM by junfeng
Norman,

Again, I don't work in File System team so I can't answer any of your questions.

# re: Symbolic link in Windows Vista

Saturday, April 22, 2006 6:33 AM by Martin v. Löwis
Looking at the documentation, it is unclear how to determine (programmatically) that a directory entry is a symbolic link, and there seems to be no API to get the contents (i.e. target path name) of the link.

# re: Symbolic link in Windows Vista

Thursday, June 22, 2006 10:44 PM by jsminch
This is great.  I love the symbolic link idea.  
I did not see anywhere in your example or in the MS doc wheather or not deleting the link deletes the object that it links to (a weakness of "junction points").  But I will assume that it does not (hopefully you didn't delete your windows directory), so, groovy.
I hope they work it into the GUI.

# Scott Hanselman's Computer Zen - More on Vista Reparse Points

# re: Windows Vista 体験記 - mklink

Sunday, October 22, 2006 12:06 AM by 囚人のジレンマな日々

re: Windows Vista 体験記 - mklink

# Symbolics links in Vista

Tuesday, November 28, 2006 4:11 PM by Simon Thorneycroft and Jonathan Hodgson

A new but low-level addition to Vista is the support for symbolic links in the file system. These are...

# The Jog &raquo; Archives &raquo; Organization, by Vista

Wednesday, February 28, 2007 3:52 AM by The Jog » Archives » Organization, by Vista

# Para onde foi o SendTo - parte 2

Sunday, March 04, 2007 7:25 PM by Dennes

Depois de pesquisar acabei descobrindo que as JUNCTIONS existem no sistema operacional desde...

# Columbia Enterprise Developers Guild Begins

Friday, May 11, 2007 12:28 AM by Chris Eargle

Columbia Enterprise Developers Guild Begins

# Columbia Enterprise Developers Guild Begins

Friday, May 11, 2007 12:40 AM by Shadowin

A couple of months ago, I began searching for local developer user groups to take part in Columbia, SC. Unfortunately, there didn&rsquo;t seem to be a lot going on. I ended up heading to the Charlotte Enterprise Developers Guild to get my fix. There,

# Whew! &laquo; Pneumonochrome

Friday, November 09, 2007 1:24 AM by Whew! « Pneumonochrome

# Junction Links / Symbolic Links &laquo; Iain&#8217;s Blog

Monday, January 14, 2008 7:28 PM by Junction Links / Symbolic Links « Iain’s Blog

# Software Information &raquo; Junfeng Zhang&#8217;s Windows Programming Notes : Symbolic link in Windows Vista

# Adam Myers | True symlinks in Windows Vista

Monday, March 10, 2008 11:23 AM by Adam Myers | True symlinks in Windows Vista

# http://blogs.msdn.com/junfeng/archive/2006/04/15/576568.aspx

# EricMMartin.com &raquo; Symbolic links in Windows

Friday, April 04, 2008 1:28 PM by EricMMartin.com &raquo; Symbolic links in Windows

# The IceMan &raquo; Symbolic Link ב-Windows Vista

Monday, August 18, 2008 3:01 PM by The IceMan &raquo; Symbolic Link ב-Windows Vista

# TQVault + Lilith MOD - Titan Quest Forums

Sunday, December 14, 2008 10:12 PM by TQVault + Lilith MOD - Titan Quest Forums
New Comments to this post are disabled
 
Page view tracker