I am writing some program to get the list of shortcut files on Desktop. and I find some strange things about this.
Most programs will create shortcut files on Windows Desktop like "Mozilla Firefox.lnk" or "Google Chrome.lnk" after installed. I can see these shortcuts on Desktop and use them to launch programs.
But I find that if you use Windows Explorer to open the desktop folder, you can't see these lnk files on the list. Some lnk files are visible while some are not (e.g. Mozilla Firefox, Google Chrome, Opera). That's the strangest part. I can't tell what's the different between them.
Then I try to open the cmd program and use "dir" command to list the files on Desktop and also can not see these files.
Then I try to write some code to test with C#
File.Exists(@"C:\Documents and Settings\user\Desktop\Google Chrome.lnk")
The result is "False", that means the lnk file is not exist on the Desktop.
Then I move the "Google Chrome.lnk" from desktop to a folder and move it back.
Now I can see it on Windows Explorer and cmd "dir" command
and the result of the code
File.Exists(@"C:\Documents and Settings\user\Desktop\Google Chrome.lnk")
is "True".
I have no idea what has been changed after the lnk file move out from desktop and move back, but now it appears like a normal file.
Does anyone notice this and know why it likes this?
Thanks.
The answer is:
Some lnk files are in the "All Users\Desktop" folder
not in the current user's Desktop
Thanks to @DanielA.White
I know this is a really old thread, but I thought I'd share anyway. I had a .Ink file on my desktop that would not delete. After trying to delete it a number of times in different ways I decided to just right click the desktop and click refresh. It disappeared! Sounds too easy to be true doesn't it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With