SkillAgentSearch skills...

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/SetFolderIcons
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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.ico if present in the folder
  • Priority 2: Extracts icon from single .exe file when no icon.ico exists
  • Priority 3: When multiple .exe files 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

  1. Download the repository:

    git clone https://github.com/L-at-nnes/SetFolderIcons.git
    cd SetFolderIcons
    
  2. Run the application:

    .\SetFolderIcons-GUI-v3.ps1
    

    Or bypass execution policy if needed:

    powershell -ExecutionPolicy Bypass -File "SetFolderIcons-GUI-v3.ps1"
    

How It Works

Automatic Processing

  1. Select your working folder (defaults to script directory)
  2. Click "Start automatic processing"
  3. The app scans direct subfolders (not recursive)
  4. Icons are applied based on priority rules
  5. Results appear in the statistics panel

Manual Processing

  1. Switch to the Manual Mode tab
  2. Click "Analyze folders" to find problematic folders
  3. Select a folder from the list
  4. Choose an executable from the visual picker
  5. Click "Apply selected icon"
  6. 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 → ExtractIcon
  • user32.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


View on GitHub
GitHub Stars7
CategoryCustomer
Updated17d ago
Forks0

Languages

PowerShell

Security Score

75/100

Audited on Mar 14, 2026

No findings