Search code examples
windowswindows-7ntfssymlink

How to check what symbolic links are used in a folder in Windows 7


I've been looking at the Windows 7 symbolic links (using mklink) [Edit - they are also supported on Windows Vista, Windows Server 2003, Windows Server 2008]. Is it possible to programmatically determine if a folder is a symlink?


Solution

  • Use GetFileAttributes and check for FILE_ATTRIBUTE_REPARSE_POINT.

    ETA: Since you clarified now that you're doing this from C#, you can do this natively there:

    System.IO.File.GetAttributes("some/path")
    

    You can check for the ReparsePoint flag in the returned enum value.