Is there a way to easily set the icon a folder uses?

As far as I know, for an icon on Windows you must use an .ico file. Although in Win9x days one could get away by using a renamed .bmp, but they look just terrible next to fancy Aero icons – especially since a typical ICO contains several image sizes with transparency layers.

You can use ImageMagick to convert a PNG image to an ICO file:

convert foo.png foo.ico

or if you have PNGs of several sizes,

convert foo-*.png foo.ico

The other part, making Windows use your icon, is easier:

  1. Create a desktop.ini file in your directory, with the following contents:

    [.ShellClassInfo]
    IconFile=folder.ico
    IconIndex=0
    

    Relative paths for IconFile should be supported; they will also work over the network.

    See this MSDN article for detailed instructions on setting the folder icon programmatically.

  2. Mark the directory as either "Read-only" (preferred) or "System":

    attrib +r Music
    

    Without this, Explorer won't even look for desktop.ini customizations, for performance reasons (as explained in The Old New Thing).

  3. Optionally mark desktop.ini as hidden, so that it won't clutter the file list:

    attrib +h +s desktop.ini
    

Nope, .ICO files are used (exclusively) for the Icons of folders (since, well, they're Icons ;) ).

You're best/only bet is to convert the image file(s) to the .ICO format.

Perhaps check out these for some ideas/utilities to make the conversion easier on you:

  • How do I convert a .PNG into a .ICO?
  • https://superuser.com/questions/147056/what-tool-can-i-use-to-convert-various-formats-into-icon-files
  • Batch convert SVG images to desired size PNG or ICO

Personally I like Axialis' IconWorkshop for all my .ICO needs. :)

As for injecting/assigning them without using the Properties, that's a different story, and actually pretty easy.

You can specify it by creating/modifying the desktop.ini (text) file in the folder you wish to apply the icon to. Note: this file is a 'hidden' and 'system' file.

Example desktop.ini:

[.ShellClassInfo]
IconResource=C:\Users\techie007\Documents\myNukeBall.ico,0