Creates a symbolic link.
To perform this operation as a transacted operation, use the
CreateSymbolicLinkTransacted function.
Syntax
BOOLEAN WINAPI CreateSymbolicLink(
__in LPTSTR lpSymlinkFileName,
__in LPTSTR lpTargetFileName,
__in DWORD dwFlags
);
Parameters
- lpSymlinkFileName [in]
-
The symbolic link to be created.
- lpTargetFileName [in]
-
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.
- dwFlags [in]
-
Indicates whether the link target, lpTargetFileName, is a directory.
| Value | Meaning |
- 0x0
| The link target is a file.
|
- SYMBOLIC_LINK_FLAG_DIRECTORY
- 0x1
| The link target is a directory.
|
Return Value
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.
Remarks
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:
Requirements
| Minimum supported client | Windows Vista |
| Minimum supported server | Windows Server 2008 |
| Header | WinBase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
| Unicode and ANSI names | CreateSymbolicLinkW (Unicode) and CreateSymbolicLinkA (ANSI) |
See Also
- CreateSymbolicLinkTransacted
- File Management Functions
- Symbolic Links
Send comments about this topic to Microsoft
Build date: 10/22/2009