Jump to content
Sign in to follow this  

Do Folderpic

Recommended Posts



i would like to set some ico-files as Folderpic (using Windows Vista).

the manuell way goes over customize in properties.

because i have a lot of folders, i will automate this. the ico-files are already in the folders, where they should be the folderpic.

when i do this manually, an file called "desktop.ini" is created in each folder.

so i try to create these file via autoit, but the folderpic does not change.

did somebody know a way, how i can change easily folderpics via autoit?

creating the ini-file could be a part of this routine, maybe a dllcall or somethin like that is missing ...

thank you =)

Share this post

Link to post
Share on other sites


i watn to change the folder icon themselves.

so that i do not have the bad foldericon from windows, instead the nice icon in my explorer ;-)

Share this post

Link to post
Share on other sites

This works sometimes, I think you need to restart explorer or something.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $sLocation = @HomeDrive
Global $sFilename = @SystemDir & "\shell32.dll"

$frmIcon = GUICreate("Change Folder Icons", 290, 187)
GUICtrlCreateGroup("", 8, 0, 273, 178)
GUICtrlCreateLabel("Folder:", 16, 16, 36, 17)
$inpLocation = GUICtrlCreateInput("", 56, 16, 217, 21)
$btnChange = GUICtrlCreateButton("Change Folder", 152, 40, 123, 25)
GUICtrlCreateLabel("Folder:", 16, 16, 36, 17)
GUICtrlCreateLabel("Icon:", 16, 68, 36, 17)
$inpIcon = GUICtrlCreateInput("", 56, 68, 217, 21)
$btnIcon = GUICtrlCreateButton("Change Icon", 152, 92, 123, 25)
$btnSave = GUICtrlCreateButton("Save", 172, 148, 99, 25)
GUICtrlCreateLabel("Index:", 16, 120, 33, 17)
$inpIndex = GUICtrlCreateInput("", 56, 120, 217, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $btnChange
            $sLocation = FileSelectFolder("Select Folder", @HomeDrive)
            GUICtrlSetData($inpLocation, $sLocation)
        Case $btnIcon
            $sFileName = FileOpenDialog("Select file:", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "Executables & dll's (*.exe;*.dll;*.ocx;*.icl)")
            If @error Then ContinueLoop
            GUICtrlSetData($inpIcon, $sFileName)
        Case $btnSave
            _Write(GUICtrlRead($inpLocation), GUICtrlRead($inpIcon), GUICtrlRead($inpIndex))

Func _Write($ioLocation, $ioIcon, $ioIndex)
    $ioLocation = $ioLocation & '\desktop.ini'
    IniWrite($ioLocation, ".ShellClassInfo", "IconResource", $ioIcon & "," & $ioIndex)

    FileSetAttrib($ioLocation, "+SH")
    MsgBox(64, "Folder Icons", "Saved!")

Share this post

Link to post
Share on other sites


thank you, but that does not work for me (vista).

what process is behind changing folderpic via properties?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.