# Command for changing folder icon

**URL:** <https://resource.dopus.com/t/command-for-changing-folder-icon/51924>\
**Category:** Help & Support\
**Created:** [July 23, 2024, 9:15pm UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924 "2024-07-23T21:15:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xavierarmand](https://resource.dopus.com/user_avatar/resource.dopus.com/xavierarmand/32/51554_2.png) [@xavierarmand](https://resource.dopus.com/u/xavierarmand)\
**Post date:** [July 23, 2024, 9:15pm UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/1 "2024-07-23T21:15:21Z")

</div>

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](https://resource.dopus.com/uploads/default/original/3X/d/f/df97661e5bfaa7f3df9ce110de47cdd617e3054e.png)

 ![image](https://resource.dopus.com/uploads/default/original/3X/3/3/330f988f83871b74f8c853905233581022a66e1f.png)

---

<div class="post-metadata">

**Author:** ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)\
**Post date:** [July 23, 2024, 9:19pm UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/2 "2024-07-23T21:19:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xavierarmand](https://resource.dopus.com/user_avatar/resource.dopus.com/xavierarmand/32/51554_2.png) [@xavierarmand](https://resource.dopus.com/u/xavierarmand)\
**Post date:** [July 23, 2024, 9:28pm UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/3 "2024-07-23T21:28:09Z")

</div>

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](https://www.lopesoft.com/fmtools/help/enu/ChangeIcon.html).

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

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [July 23, 2024, 10:55pm UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/4 "2024-07-23T22:55:05Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![xavierarmand](https://resource.dopus.com/user_avatar/resource.dopus.com/xavierarmand/32/51554_2.png) [@xavierarmand](https://resource.dopus.com/u/xavierarmand)\
**Post date:** [July 23, 2024, 11:48pm UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/5 "2024-07-23T23:48:00Z")

</div>

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.

 ![image](https://resource.dopus.com/uploads/default/original/3X/3/9/3991a6c2336a438c6269ef15afe5f5ec85dce1dd.png)  
 ![image](https://resource.dopus.com/uploads/default/original/3X/e/a/ea7a0d45519d8a0fea8720a9c10bc6b8c7f43c9d.png)

* * *

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 🤣 🤣 🤣

 ![image](https://resource.dopus.com/uploads/default/original/3X/3/8/38163d337f8bbfdc711caeaf02275c494b34a9bd.png)

---

<div class="post-metadata">

**Author:** ![xavierarmand](https://resource.dopus.com/user_avatar/resource.dopus.com/xavierarmand/32/51554_2.png) [@xavierarmand](https://resource.dopus.com/u/xavierarmand)\
**Post date:** [July 24, 2024, 2:33am UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/6 "2024-07-24T02:33:42Z")

</div>

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

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

```

and it gives me this popup...

![image](https://resource.dopus.com/uploads/default/original/3X/4/4/44e24bf4a9b1f604ebc3e260e1a05dcbace97ffc.png)

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

---

<div class="post-metadata">

**Author:** ![xavierarmand](https://resource.dopus.com/user_avatar/resource.dopus.com/xavierarmand/32/51554_2.png) [@xavierarmand](https://resource.dopus.com/u/xavierarmand)\
**Post date:** [July 25, 2024, 2:09am UTC](https://resource.dopus.com/t/command-for-changing-folder-icon/51924/7 "2024-07-25T02:09:31Z")

</div>

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](https://resource.dopus.com/uploads/default/original/3X/f/3/f387190a3cd0438262f962dfe4245069229c559a.gif)

## The Dopus button code is...

```auto
@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._

```ahk
#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`.

```auto
@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! 😃 ❤

# 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](https://resource.dopus.com/t/change-folder-ico/54858)
