How to get the .ico file of an arbitrary file?

6

Say I have a file and there is set an icon to it. How to get the icon which is figured on the file? File is an arbitrary - some extension about which I have no idea. Just how to get its icon.

EDIT: BTW the icon which is figured on the file is assigned when I told to SO open the file with an exe file I have created. And in that exe file there is no the icon that is on the file. Just, I guess, OS (Vista) have crated the icon of the file by takeing the icon of exe file and bu "putting" that on a white paper. SO I want to get this icon.

Narek

Posted 2010-07-26T18:53:33.647

Reputation: 1 251

Answers

5

File association icons are assigned by Windows, most of which are found in %Windir%\system32\shell32.dll. You can find out which file provides a particular icon by going to Tools - Folder Options - File Types and then clicking the 'Advanced' button for your desired file type. Finally, click 'Change icon' in the window that appears and it will show you the path to the file's icon.

You can use Resource Hacker to export the icon from the file.

Rob

Posted 2010-07-26T18:53:33.647

Reputation: 236

What about for Vista? – Narek – 2010-07-26T20:02:52.173

Vista OS Icon Location: C:\Windows\System32\imageres.dll C:\Windows\System32\shell32.dll – djshortbus – 2010-07-26T20:31:03.870

"Finally, click 'Change icon' in the window that appears and it will show you the path to the file's icon." I meant where to find to path of the current icon in Vista? – Narek – 2010-07-27T06:45:20.657

1

Vista does not offer extensive file type configuration like XP, unfortunately. To retrieve the icon location of a specific filetype you need to access the registry.

  1. Run regedit.
  2. Navigate to ..\HKEY_CLASSES_ROOT\
  3. Find the key of your filetype. In my example, it's .ace.
  4. Read the (Default) value. In my case it reads "WinRAR".
  5. Navigate to the key of this value (..\HKEY_CLASSES_ROOT\WinRAR)
  6. Open the DefaultIcon key.
  7. The (Default) value of this key contains the path to the icon. (C:\Program Files\WinRAR\WinRAR.exe)

Screenshot: http://tinyurl.com/39qakoe

– Rob – 2010-07-30T20:45:07.457

as an aside, if you then wanted to change the icon, you could use something like http://www.botproductions.com/iconview/iconview.html to find an icon you would like to use.

– Robert S Ciaccio – 2010-08-05T00:30:32.903

1

Batch Icon Extractor

Download BatchIconExtractor.exe and place it on your desktop. Drag and drop a file or a folder on the application icon. All icons from the file or from all files under the given folder are saved to a new folder called "icons". This folder is created in the same folder, where the application resides (Desktop by default).

djshortbus

Posted 2010-07-26T18:53:33.647

Reputation: 517

Program says "The argument specified does not appear to be a file with icons or a folder." BTW the program is right. This icon was "granted" to it extension by Win. Vista. So the icon should be somwhere else not in the file. – Narek – 2010-07-26T20:02:37.167

1

The only way I know, apart from digging in the registry, is with .Net code. There's a function called ExtractAssociatedIcon() which gives you the associated icon with whichever file you pass it. Perhaps not the answer you're looking for, but there is no accessible interface built into Windows for this specific task ;)

Update: For making such an app, see http://pastie.org/1075055 (copy the code using the RAW button so avoid line numbers)

invert

Posted 2010-07-26T18:53:33.647

Reputation: 4 918

0

IconPackager is a tool for Windows Vista that lets you edit the icons. (Windows XP had this ability built-in.)

ResEdit is a good resource editor which will allow you to open and save the icons contained in an .exe file.

Kevin Panko

Posted 2010-07-26T18:53:33.647

Reputation: 6 339