Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Changing Windows Shortcut Icons

by bbfu (Curate)
on Jul 15, 2004 at 08:24 UTC ( [id://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.

bbfu
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: http://www.lytebyte.com/2007/06/27/how-to-show-and-hide-file-extensions-in-windows/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://374573]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-18 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found