Get target of shortcut folder

前端 未结 7 745
名媛妹妹
名媛妹妹 2020-11-27 19:31

How do you get the directory target of a shortcut folder? I\'ve search everywhere and only finds target of shortcut file.

相关标签:
7条回答
  • 2020-11-27 20:25

    An even simpler way to get the linked path that I use is:

    private static string LnkToFile(string fileLink)
    {
        string link = File.ReadAllText(fileLink);
        int i1 = link.IndexOf("DATA\0");
        if (i1 < 0)
            return null;
        i1 += 5;
        int i2 = link.IndexOf("\0", i1);
        if (i2 < 0)
            return link.Substring(i1);
        else
            return link.Substring(i1, i2 - i1);
    }
    

    But it will of course break if the lnk-file format changes.

    0 讨论(0)
提交回复
热议问题