Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut file on Windows Desktop doesn't show in Windows Explorer

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.

like image 941
user2351537 Avatar asked Jun 16 '14 01:06

user2351537


2 Answers

The answer is:

Some lnk files are in the "All Users\Desktop" folder

not in the current user's Desktop

Thanks to @DanielA.White

like image 75
user2351537 Avatar answered Sep 28 '22 17:09

user2351537


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?

like image 44
Carol Avatar answered Sep 28 '22 19:09

Carol