Command for changing folder icon

Ist there a command i could put in a button or context menu to change a folder icon that would skip clicking through the the tabs on the property window??

it would be great to be taken directly to this dialog box in 1 click rather than 4.

i would imagine it's a window 10 shell command?? I'm just starting to get dopus commands down so i not yet sure put windows cmd into buttons.

any idea or threads i missed?

thanks
x

image

I doubt there's any way to do that natively, but maybe you could achieve the same outcome using AutoHotkey?

hmmm, ahk sound tricky, if itd be a macro, hmmmm, possibly.

i used to use a 3rd part context menu tool software that had a built in shortcut for this, via their gui, i haven't used it a while as dopus has made it obsolete...

had to go find it FileMenu Tools User Manual - Change Icon.

think i even tried to find the command they used in the software but in coded\hidden in binary.

Changing the icon via the Properties dialog will ultimately create (or update) a desktop.ini file in the folder which points to the icon and has the H+S attributes set, and also sets the R attribute on the folder itself (so Windows knows to check the desktop.ini file inside the folder).

Automating those parts would be fairly easy. Showing an icon picker might be harder, as I don't think we have scriptable one of those, and the more general File Open dialog would only let you select standalone .ico files, not icons inside exe and dll files. (Maybe there's an icon browser component for AHK or similar, though.)

1 Like

I'm playing with a Desktop.ini Editor.
a bit confonsued about how to set up the command lines in button.

i have dedicated directory of .ico i keep in C:\Icons so a file picker is optional. i have an ico: filter set up through everything with a copy path hotkey, makes all this quick except clicking through windows properties boxes.

the only time i use an .exe for an icon is for app buttons.



also this 2nd context menu tool has a change icon item that pop ups its own icon picker pointed at shell32.dll with a browse button
the software will open the Regedit key for you. its command is ...

%ProgramFiles%\Easy Context Menu\EcMenu.exe /Admin /ChangeIcon "%1"

as it points to itself i can't figure out if they've just hidden a shell command under the hood. i expect they are.

alas google is no help anymore. all you get is AI articles re-vomited up form 2012 and adds for coffee makers. ugh. hahaha :rofl: :rofl: :rofl:

1 Like

well i copied that command from the reg entry into a button...

@disablenosel:dirs
@dirsonly
@admin
"C:\Program Files\Easy Context Menu\EcMenu.exe" /Admin /ChangeIcon "%1"

and it gives me this popup...

image

i wish dopus was handling it somehow, but it working so that cool.

1 Like

Okay!

Spent the afternoon playing in AutoHotKey to make a script for a button that brings me through 3 windows to the File Picker Window! AHK is as much a must as Dopus so option keeps the task of changing a folder icon controlled, seemingly, by Dopus itself without opening another utility that I wouldn't be using otherwise.

dopus_2024-07-24_07-05-16PM_x

The Dopus button code is...

@disablenosel:dirs
@dirsonly
@nodeselect
@admin
Properties
@sync:"C:\Users\%userprofile%\Documents\AutoHotkey\Lib\change folder icon via dopus.ahk"

// update the location & name of your `.ahk` script accordingly 

// https://resource.dopus.com/t/command-for-changing-folder-icon/51924

The AutoHotkey Code...

I love AHK, thou it can be a pain in the butt! This is working 90% of the time, occasionally it will miss sending a ControlClick Input which just stops it navigating thru the pop up windows.

Should anyone try to use this code you can the adjust the SetControlDelay, 70 and\or the sleep 200 delays between the actions to meet your systems speed needs.

also...

IMPORTANT!
The ControlClick commands are sent to a Position coordinate measured in pixels, e.g. X172 Y54, within the Properties Popup windows. I am on a 4k mointer with Windows DPI Scaling at 125%...

So these coordinates will likely have to remapped using AHKs Windowspy on your system for them to work!

I also left additional notes commented out in the script below.

#NoEnv ;recommened for performanc and compatiblity with futrure AHK releases.
#SingleInstance,Force
;#Persistent,Force
#warn  ; enable warning to assist with decting common errors.
;#NoTrayIcon
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetTitleMatchMode 2
coordmode, mouse, window
SetControlDelay, 70

;If !A_IsAdmin
  ;Run *RunAs "%A_ScriptFullPath%"

;  https://resource.dopus.com/t/command-for-changing-folder-icon/51924


; AHK has two syntax modes for sending ControlClick, naturally windows and\or ahk couldn’t play together using just one mode
; I had to mix them to navigate the changeing of tabs & pops up, both modes examples are here for reference if the scripts decides to break itself.

; syntax for
; ControlClick, Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText


sleep 850 ; waits for Dopus to open the Properties Window

#IfWinExist , Properties ahk_class #32770 ahk_exe dopus.exe

; mode 1
ControlClick, X172 Y54, Properties, , Left, 1, na ;*works
; mode 2
; ControlClick, SysTabControl321, Properties, , Left, 1, X165 X14 na

sleep 400

; mode 1
; ControlClick, X116 X426, Properties, , Left, 1, na
; mode 2
ControlClick, Button7, Properties, Change &Icon..., Left, 1, na ;*works

sleep 400

; mode 1
 ControlClick, X286 Y84, Change Icon for, , left, 1, na ;*works
; mode 2
; ControlClick, Button1, Change Icon for, &Browse..., left, 1, na 

sleep 400

; Send ^v  ;Uncomment if you've set yourself up to have a `.ico` file path waiting in your clipboard

; Return

ExitApp

; No need for #Persistent or Return. The script will only run once then exit after these lines execute.
; If you copy this piece of code into a #Persistent Script uncomment the Return & delete the ExitApp

Best Luck!
X

UPDATE ;*************************

I found a way to incorprate this script into my main AutoHotkey Script by assigning it an odd hotkey F16, replased the ExitApp with a Return then in the Dopus Button I added... @sendkey:F16.

@disablenosel:dirs
@dirsonly
@nodeselect
@admin
Properties
@sendkey:F16
//@sync:"C:\Users\CLOUDEN\Documents\AutoHotkey\Lib\change folder icon via dopus.ahk"

Dopus and AHK are too much fun! :smiley: :heart:

UPDATE 03-10-2025

Forget about this old janky scipt.
I wrote a whole new script\app with a GUI that has bells & whistles and dopus integration.
i posted about here.... Change Folder ICO

2 Likes