SetFolderIcons
Modern PowerShell GUI to automatically customize Windows folder icons based on executables or icon files. Features dual themes, multi-language support, and portable relative paths.
Install / Use
/learn @L-at-nnes/SetFolderIconsREADME
Set Folder Icons
A modern PowerShell GUI application that automatically customizes folder icons based on executables or custom icon files. Built with WPF for a clean, responsive interface.
Features
Automatic Mode (AIO)
Intelligently processes all subfolders with a priority-based system:
- Priority 1: Uses
icon.icoif present in the folder - Priority 2: Extracts icon from single
.exefile when noicon.icoexists - Priority 3: When multiple
.exefiles exist but only one has a custom icon (others use the default Windows icon), automatically uses that exe's icon - Smart Skip: Remaining folders with multiple executables (all with custom icons or none) are sent to Manual Mode for user selection
Manual Mode
Handles edge cases where automatic processing isn't possible:
- Visual display of all executable files with their icons
- Click to preview and select which icon to use
- Auto-syncs with Automatic Mode results
Themes
Switch between visual themes on the fly:
- Light Theme: Clean, bright interface with blue accents
- Ocean Theme: Calm, teal-inspired color palette
Multi-Language Support
Full interface translation:
- English (EN) - Default
- French (FR)
Real-Time Statistics
Track your progress with live counters:
- Total folders analyzed
- Successfully processed folders
- Folders requiring manual selection
- Errors encountered
Requirements
- Operating System: Windows 10 or later
- PowerShell: Version 5.1 or higher
- .NET Framework: 4.5 or later (usually pre-installed on Windows)
Installation
-
Download the repository:
git clone https://github.com/L-at-nnes/SetFolderIcons.git cd SetFolderIcons -
Run the application:
.\SetFolderIcons-GUI-v3.ps1Or bypass execution policy if needed:
powershell -ExecutionPolicy Bypass -File "SetFolderIcons-GUI-v3.ps1"
How It Works
Automatic Processing
- Select your working folder (defaults to script directory)
- Click "Start automatic processing"
- The app scans direct subfolders (not recursive)
- Icons are applied based on priority rules
- Results appear in the statistics panel
Manual Processing
- Switch to the Manual Mode tab
- Click "Analyze folders" to find problematic folders
- Select a folder from the list
- Choose an executable from the visual picker
- Click "Apply selected icon"
- Folder is automatically removed from the list
Technical Details
Architecture
The application is split into four modules:
- SetFolderIcons-GUI-v3.ps1: Main entry point, UI definition (XAML), event handlers
- Themes.ps1: Theme color definitions and application logic
- Translations.ps1: Multi-language string dictionaries
- Core-Functions.ps1: Icon extraction, desktop.ini creation, folder analysis
How Icons Are Applied
The app creates a desktop.ini file in each folder with relative paths to make folders portable:
[.ShellClassInfo]
IconResource=.\icon.exe,0
IconFile=.\icon.exe
IconIndex=0
This allows you to move folders to different locations while preserving custom icons.
Then sets Windows attributes:
desktop.ini→ System + Hidden- Parent folder → Read-only
Icon Extraction
Uses Windows API calls via C# interop:
shell32.dll→ ExtractIconuser32.dll→ DestroyIcon
Icons are extracted at runtime and displayed as 32x32 pixel previews in the manual mode.
Processing Priority
| Situation | Action |
|-----------|--------|
| icon.ico exists | ✅ Use icon.ico |
| Single .exe (no icon.ico) | ✅ Extract icon from exe |
| Multiple .exe, only one with custom icon | ✅ Auto-use the exe with custom icon |
| Multiple .exe, several/no custom icons | ⚠️ Send to Manual Mode |
| No .exe or icon.ico | ❌ Skip folder |
Troubleshooting
Icons not showing after applying
Solution: Wait a little, press F5 in File Explorer or restart Explorer:
Stop-Process -Name explorer -Force
"Execution of scripts is disabled" error
Solution: Enable script execution (run as Administrator):
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Application won't start
Solution: Ensure all module files are in the same directory as the main script:
- Themes.ps1
- Translations.ps1
- Core-Functions.ps1
Customization
Adding a New Theme
Edit Themes.ps1 and add a new entry to the $script:Themes hashtable:
MyTheme = @{
Name = "MyTheme"
WindowBg = "#XXXXXX"
HeaderBg = "#XXXXXX"
# ... other color definitions
}
Then add a button in the XAML section of the main file.
Adding a New Language
Edit Translations.ps1 and add a new language code:
ES = @{
AppTitle = "Establecer Iconos de Carpetas"
# ... other translations
}
Add corresponding flag image to assets/ folder.
Contributing
Contributions are welcome! Feel free to:
- Report bugs via GitHub Issues
- Suggest new features
- Submit pull requests
License
This project is open source and available under the MIT License.
Author
Created by L-at-nnes
