A tiny Windows tool to add a right-click menu entry that lets you set any image as the current folder’s icon.
Right-click on an image file (BMP, GIF, JPG, JPEG, PNG, TIFF, WEBP) and choose "Set as Folder Icon".
This script will:
- Convert the image into a
.icofile using ImageMagick, - Write a
desktop.inifile with the necessary icon settings, - Set the folder’s attributes so Windows recognizes the icon.
The change is visible in File Explorer (you may need to refresh or reopen the window).
- Windows 10 or 11
- PowerShell (built-in)
- ImageMagick installed and available in your system's
PATH
You can download ImageMagick from their website:
👉 imagemagick.org/script/download.php#windows
Or install it from a terminal with one of these (admin rights may be needed):
winget install ImageMagick.Q16-HDRI
scoop install main/imagemagick
choco install imagemagickTo verify it’s working, try this:
Copy
Edit
magick logo: logo.gif
magick identify logo.gif-
Download this folder and place it somewhere safe on your computer;
-
Right-click
setup_context_menu.ps1and select Run With PowerShell (might require administrative rights)
This registers the context menu for supported image types.
Note
🔁 You can move the folder later, but you’ll need to re-run setup_context_menu.ps1 if you do.
This is because the right-click menu points to the script’s current location.
-
Right-click an image → choose Set as Folder Icon.
-
The icon file (
icon.ico) and configuration (desktop.ini) are saved in the same folder as the image.
That’s it! Your folder will now show the custom icon.
Just delete the icon.ico or desktop.ini file from the folder.
Right-click uninstall_context_menu.ps1 → Run With PowerShell (might require administrative rights).
| File | Purpose |
|---|---|
set_folder_icon.ps1 |
Main script: converts image & sets icon |
setup_context_menu.ps1 |
Adds the right-click context menu |
uninstall_context_menu.ps1 |
Removes the context menu |
🔍 Advanced Notes
-
magickconverts the image toicon.icousing multi-resolution settings (64, 128, 256). -
A
desktop.inifile is written with the following contents:ini
CopyEdit
[.ShellClassInfo] IconResource=icon.ico,0 -
The script marks the folder with
+s +rattributes so that Windows uses the.inifile. -
The icon and
.iniare marked as hidden/system files so they don't clutter the view.
If icon.ico or desktop.ini already exists, they will be overwritten without prompting.
This avoids clutter and ensures a clean overwrite.
Windows sometimes caches folder icons aggressively. If your new icon doesn’t appear immediately, try one of these:
-
Press
F5to refresh the folder. -
Close and reopen File Explorer.
-
Reboot your system
Still not working and can't wait for a reboot?
[!WARNING]
Run the included
reset_explorer_icon_cache.ps1
(Right-click → Run with PowerShell)
This will:
-
Close all File Explorer windows
-
Delete Windows’ icon cache
-
Restart Explorer automatically
⚠ Make sure to save any open work — this will temporarily shut down Explorer.
If you find this useful, feel free to buy me a coffee!