How do I have FileInfo object recognize a shortcut

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Ulrich

    How do I have FileInfo object recognize a shortcut

    I have two files: C:\ThisIsReal.t xt which is a real text document,
    and C:\ThisIsAShort cut, which is set up via the Windows Explorer to be a
    shortcut to the real text document.

    How Can I get the .NET System.IO.FileI nfo object to recognize the existence
    of the shortcut, and better yet, get .NET to follow the shortcut and read the
    actual real text file just like Windows Explorer does when you dbl-click the
    shortcut. Here is sample code - the file is visible in the Windows Explorer,
    but FileInfo can't see it. I can't figure out any .NET object which can see
    it. Any thoughts?

    Dim file As New System.IO.FileI nfo("C:\ThisIsA Shortcut")

    If file.Exists Then
    MsgBox("Exists" )
    Else
    MsgBox("Doesn't Exist") ' This will always get hit for
    shortcuts
    End If

Working...