YMMV - but here is a script I've used to accomplish this task.
The OP's message isn't too clear to me how he's attempting to change it, shortcut on desktop or file on disk? If you have a FILE, you can not usually change the icon, it is either the one stored in the file or the icon of the application that will open it set by windows? If you have a CMD file, you can change it, as a shortcut on the desktop, not the file itself via Explorer. I created a TEST.CMD, then made a NEW SHORTCUT to it on the desktop. I can change the icon (as expected). Not the file though.
Windows, Command, Batch and Automated Folder Icon Changer. Ask Question. Though it does not always change the icon of the folder. When you rename the ini file, the file manager is aware of the change and I suspect that is why the icon changes at that time. If you change some ini files and restart the filemanager, do the new icons also. Delete the shortcut and re-create URL file and it still shows the old icon regardless. Change name of the URL file and it gets the new icon. Tried this on XP and Windows 7, e.g. Create WITH icon. Run again with different icon or faulty ICO name. = shortcut stays the same 1. Create without icon, or with faulty one (white icon) 2.
At least that is how I understand it works, just as LH stated. Ok, here's the deal. I created a.cmd file (windows script command - like LH states above). I wanted to change the icon for that file to something else. I know that i can change the icon for that file type.
However, i just want to change the icon for that one file so that it is different from the others. I found a youtube video showing that icolorfolder can change the icon for individual files. That program was even reviewed here once by The Geek. However the app is not Windows 7 compatible.
I figure if the app can do it then there might be a way i can do it without installing an app to do it. If i can't that's fine if anyone knows of a windows 7 compatible app that i can use. I've taken a look at that iColorFolder and it looks interesting. Can't test it out right now, because I'm trying to format a very reluctant drive, so I'm creating another backup as a precaution before I make any more moves and that alone will take at least a couple more hours. But when all is up and running again and I have a safe image ofall when all is well, I'll try and install it on vista and see if it can be made compatible (if so, it will probably work on 7 too) or at least find out how it changes the icon for a single file.
For folders it is easy - the referrence in desktop.ini get's changed. I wonder if it has found a way to put a referrence to a single file in the desktop.ini file. In that case the iconchange would be lost if the file is moved to another location.