Creates a symbolic link.
To perform this operation as a transacted operation, use the CreateSymbolicLinkTransacted function.
BOOLEAN WINAPI CreateSymbolicLink( __in LPTSTR lpSymlinkFileName, __in LPTSTR lpTargetFileName, __in DWORD dwFlags );
The symbolic link to be created.
The name of the target for the symbolic link to be created.
If lpTargetFileName has a device name associated with it, the link is treated as an absolute link; otherwise, the link is treated as a relative link.
Indicates whether the link target, lpTargetFileName, is a directory.
The link target is a file.
The link target is a directory.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Symbolic links can either be absolute or relative links. Absolute links are links that specify each portion of the path name; relative links are determined relative to where relative–link specifiers are in a specified path. Relative links are specified using the following conventions:
Note If you specify a current working directory–relative link, it is created as an absolute link, due to the way the current working directory is processed based on the user and the thread.
Send comments about this topic to Microsoft
Build date: 7/9/2009
And how do you remove a symbolic link?
There seems to be no function RemoveSymbolicLink or DeleteSymbolicLink.
[Noelle Mallory - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content.
<DllImport("kernel32.dll", EntryPoint:="CreateSymbolicLinkW", CharSet:=CharSet.Unicode)> _Public Shared Function CreateSymbolicLink(<[In]()> ByVal lpSymlinkFileName As String, <[In]()> ByVal lpTargetFileName As String, <[In]()> ByVal dwFlags As Integer) As IntegerEnd Function
[DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", CharSet=CharSet.Unicode)] public static extern int CreateSymbolicLink([In] string lpSymlinkFileName, [In] string lpTargetFileName, int dwFlags);