Thursday, November 18, 2010

How do i change icon of every folder at once using REGISTRY, BATCH FILES or VBS SCRIPT?

How do i change icon of every folder at once using REGISTRY, BATCH FILES, VBS SCRIPT, ANY OTHER SCRIPT or a software to change icon from COMMAND LINE.



PS

1. i dont want to change icons using any software like StyleXP

2. i know i can change from Tools%26gt;Folder Options%26gt;File Types and selecting FILE FOLDER, but i want it to be done automatically. Either from registry or batch file or msdos or by using a software that supports command line switchesHow do i change icon of every folder at once using REGISTRY, BATCH FILES or VBS SCRIPT?
I don't think it can be done. You are talking about changing a property value of all folders, but it is an interesting concept. If there is a way to change them then a batch file should do it.



Check back later I'll let you know what I've found or can put together.



The second suggestion may work not sure but it should change the thumbnail view of the folders at least. Very similar to to what Microsoft has published.



http://msdn.microsoft.com/library/defaul



If you would like to read it.



I was able to change some folder's using the following key



HKEY_CLASSES_ROOT\Folder\DefaultIcon



and mapped the icons in the shell32.dll starting from top to bottom and left to right. In other words the top left icon is 1 and the bottom left icon is 4 in the first row the second row goes from 5 - 8 and so on.



So a value of %SystemRoot%\System32\shell32.dll,3 would corrosponde to the 3 icon in the first row.



That's all I got.How do i change icon of every folder at once using REGISTRY, BATCH FILES or VBS SCRIPT?
I'll start this with a warning:



WARNING: The following batch files will create and delete files. If, for some reason, you have files with the same name as these files, in any of your folders underneath the one the batch is executed from, you will lose said files. I am not responsible for any damages that may arise from your use of this method.



With that said, chances are slim that it will break anything.



First off, create the following files:



----------

icon.bat

----------

@echo off

dir /ad /b %26gt; dirs.lst

FOR /f %26quot;delims=\%26quot; %%i IN (dirs.lst) DO call changeicon.bat %26quot;%%i%26quot;

del dirs.lst



----------

changeicon.bat

----------

copy desktop.ini %1

if errorlevel 1 goto EndFile

copy icon.bat %1

copy changeicon.bat %1

attrib %1 +r

attrib %1\desktop.ini +h

cd %1

call icon

cd..

del %1\icon.bat

del %1\changeicon.bat

:EndFile

--------

end of files

--------



Next, find a folder you've already changed to the desired icon. In that folder, there should be a file named desktop.ini. If you can't find it, you'll need to enable the viewing of hidden files. To do this:



In the Explorer window viewing the folder:

Click Tools, Folder Options

Click the View Tab

Select the option that says %26quot;Show hidden files and folders%26quot;

Click OK.

The desktop.ini file should appear.



Once you've got the desktop.ini file, copy it, along with the two .bat files, to the topmost folder you want to change. For example, to change every folder on the C:\ drive, copy the three files to C:\.



Run icon.bat



Wait for it to finish, and the icons should be changed.



Note:



The desktop.ini acts as your %26quot;parameter%26quot; as it stores the icon you wish to assign to each folder. Changing the desktop.ini file and running the batch file again will reassign all the icons.



Update:

Found a problem with folders you don't have write access to causing an infinite loop. Updated second batch file to fix problem.

No comments:

Post a Comment