Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^4: Changing Windows Shortcut Icons

by bbfu (Curate)
on Jul 15, 2004 at 08:24 UTC ( #374573=note: print w/replies, xml ) Need Help??

in reply to Re^3: Changing Windows Shortcut Icons
in thread Changing Windows Shortcut Icons

Yeah, unlike *nix, Windows relies pretty heavily on file extensions; a hold-over from it's DOS days. And since there was no capacity for symlink-style referencing in the old FAT32 system, MS adopted the .lnk "special" extension. Personally, I think they should've added real symlinking when they came up with, or switched to, NTFS. But I guess "Shortcuts" worked well enough for them.

Windows treats certain file extensions (and file names) specially. Obviously .lnk is one of them, but CLSID's-as-file-extensions are another special case. (That's how the Recycle Bin, My Computer, etc, icons are handled on the desktop. Well, not really, but it does allow you to add those special "icons" to any folder, not just the desktop.)

Special file extensions are never shown in Windows Explorer, even if you have the "Hide known extensions" option disabled. Also, when renaming a file with a special extension, Explorer doesn't let you change the extension. However, you can still see and change the extension via the command line, since it doesn't treat the extensions specially. Adding a .lnk extension to a non-shortcut file doesn't actually change the file data in any way, of course, but it does change how Explorer displays and manipulates the file. Similarly, removing the .lnk extension from an actual shortcut will cause Windows to no longer recognize it as a shortcut, but it still contains the binary data that comprises a "Windows Shortcut."

In short, Explorer (mostly) only cares whether the file has a .lnk extension or not, while Windows only cares whether the file can be successfully read by the LoadShortcutFile() (or whatever it's called) system call.

Black flowers blossom
Fearless on my breath

Replies are listed 'Best First'.
Re^5: Changing Windows Shortcut Icons
by Anonymous Monk on Jul 18, 2007 at 05:34 UTC
    I know this thread is very old, but for some reason on my XP machine, I can SEE the .lnk extensions on all my shortcuts regardless of where they are. I remember intentionally enabling this but now I can't fix it. Anyone know how I can restore their previously hidden state?
      go to control pannel the folder options - the option to change it somewhere there!
      Here's your answer:

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://374573]
and the radiator hisses contentedly...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2017-05-23 18:37 GMT
Find Nodes?
    Voting Booth?