First, a little bit of theory. What happens when a person sets a custom icon for a folder in Windows 7? 1.
Attributes of a Folder change to Read-only (of the folder, NOT content!). 2.
A hidden system file created inside that folder, which contains a link to the icon.
Thus, having such file as model, it is possible simply copy it across desired folders, and change attributes of those folders correspondingly.
Secondly, having this idea in my mind, I have put all of my little knowledge of Batch files together and created a script.
BEFORE script is started the following is needed to be done:
Master folder needs to be selected and a custom icon applied to it.
ONLY AFTER THAT 1.
Script is placed inside that master folder and launched. 2.
First, script checks if hidden system file with custom icon settings is there. 3.
Secondly, script looks for subfolders and start changing its attributes. 4.
Thirdly, script copies this settings file to all subfolders of current master folder, including all levels of subfolders.
For 100 folders it took about 21 seconds, for 200 folders with different levels of subfolders it took about 57 seconds on my laptop.
I have included remarks (comments) in the source code for better understanding what is going on. UPDATE: Original file deleted. Script was not meant to be applied to system folders.
Please check a newer FIXED version at this post.
PLEASE READ NEW INSTRUCTION IN THAT POST.