
Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
On Nov 16, 4:20 pm, Mattias Sjögren <mattias.dont.want.s...@mvps.org>
wrote:
> >I'm trying to check whether a .lnk (LNK - Windows shortcut file)
> >exists. I can successfully create the lnk file and then go browse to
[quoted text clipped - 8 lines]
> Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
> Please reply only to the newsgroup.
yeah. I used Directory.SetCurrentDirectory() to set the path so I
wouldn't have to type in the full path. But not running that and just
inserting the full path still results in the same failure.
Sheng Jiang[MVP] - 16 Nov 2007 22:13 GMT
use Path.Combine to create a absolute path

Signature
Sheng Jiang
Microsoft MVP in VC++
On Nov 16, 4:20 pm, Mattias Sjögren <mattias.dont.want.s...@mvps.org>
wrote:
> >I'm trying to check whether a .lnk (LNK - Windows shortcut file)
> >exists. I can successfully create the lnk file and then go browse to
[quoted text clipped - 8 lines]
> Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
> Please reply only to the newsgroup.
yeah. I used Directory.SetCurrentDirectory() to set the path so I
wouldn't have to type in the full path. But not running that and just
inserting the full path still results in the same failure.
repairman2003@gmail.com - 19 Nov 2007 15:50 GMT
That's not the problem. The problem is the File.Exists() returns
false no matter what if it is a .lnk file. I even created one in c:\
and called File.Exists("c:\\test.lnk") and it still returns false.
repairman2003@gmail.com - 19 Nov 2007 16:01 GMT
Ok, after much headache, my boss found that windows hides the file
extension for .lnk files no matter what. So File.Exists("c:\
\test.lnk.lnk") returns true.