The target error of lnk file

Y

yxq

Hello
I use the
code(http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp) to get
the LNK file target, but i found some
error. If i have installed two OS (A and B, on two partition C:\ D:\), when
i login A OS, i want to get the lnk file target(D:\Documents and
Settings\MyName\Start Menu\Programs\WinRAR\WinRAR.lnk) in the other one OS,
but the code return the path "C:\Program Files\WinRAR\WinRAR.exe", but
actually the path should be "D:\Program Files\WinRAR\WinRAR.exe"!

How to correct the error?

Thanks
 
H

Herfried K. Wagner [MVP]

* "yxq said:
code(http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp) to get
the LNK file target, but i found some
error. If i have installed two OS (A and B, on two partition C:\ D:\), when
i login A OS, i want to get the lnk file target(D:\Documents and
Settings\MyName\Start Menu\Programs\WinRAR\WinRAR.lnk) in the other one OS,
but the code return the path "C:\Program Files\WinRAR\WinRAR.exe", but
actually the path should be "D:\Program Files\WinRAR\WinRAR.exe"!

Maybe the shell link file stores to full path which points to the file
on the C drive. Have a look at the methods of 'System.IO.Path' for
paths manipulations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top