How to do I batch change icons of folders in Windows 10

batchicons

I have a folder of 10 folders and I would like to change each folder to a different icon. Each of those icons is already made in another folder. (each folder will have a different icon)

How would I automate or batch this task to save me having to do it indivually. As I will have more sets of icons to do.

Best Answer

  • This is 3 years late but here we go

    you can manually bulk change folders' icons by

    • applying read-only attribute to the folders.
    • applying read-only attribute to desktop.ini files inside the folders.
    • the desktop.ini should correctly refer to the icon we want.

    STEP 1: ACTIVATE POWERSHELL & CREATE POWERSHELL SCRIPT

    Start Windows PowerShell with the "Run as Administrator" option. Only members of the Administrators group on the computer can change the execution policy.

    Enable running unsigned scripts by entering:

    set-executionpolicy remotesigned
    

    in notepad copy this code and save the file as script.ps1 in the directory D:\icons\

    <# copy desktop.ini recursively #>
    Get-ChildItem -Recurse -Directory|
        foreach { copy "D:\Icons\desktop.ini" $_.FullName}
    
    <# set folder attribute readonly recursively #>
    Get-ChildItem -Recurse -Directory|
        foreach {$_.Attributes = 'readonly'}
    
    <# set attribute readonly for desktop.ini recursively #>
    Get-ChildItem -Recurse -include *.ini|
        foreach {$_.Attributes = 'readonly,hidden'}
    
    <# set attribute hidden for folder.ico recursively #>
    Get-ChildItem -Recurse -include *.ico|
        foreach {$_.Attributes = 'hidden'}
    

    in notepad copy this code and save the file as enable_icons.bat in the directory D:\icons\

    @ECHO OFF
    PowerShell.exe -Command "D:\icons\script.ps1"
    PAUSE
    

    STEP 2: CREATE DESKTOP.INI FILE

    in notepad copy this code and save the file as DESKTOP.INI in the directory D:\icons\

    [.ShellClassInfo]
    IconResource=folder.ico,0
    [ViewState]
    Mode=
    Vid=
    FolderType=Generic
    

    now inside the directory D:\icons\ we should have 3 files

    • desktop.ini
    • enable_icons.bat
    • script.ps1

    STEP 3: SENDTO FOLDER

    copy enable_icons.bat to sendto folder

    use either of these to access it

    c:\users\[username]\AppData\Roaming\Microsoft\Windows\SendTo
    

    or

    %AppData%\Microsoft\Windows\SendTo
    

    FINAL STEP : HOW TO APPLY

    1. Inside each folder, place your icon and rename it to folder.ico
    2. Select [parent folder] of [folders you want to change their icons] > right click > send to > enable-icons

    if you already have only ONE icon file inside each folder use this batch script to rename them all.

    in notepad copy this code and save the file as rename_icons.bat in the same directory as [parent folder]

    @echo off
    setlocal enabledelayedexpansion
    FOR /r %%A IN (*.ico) DO (
    echo.
    echo "%%A"
    REN "%%~fA" "folder.ico")
    
    pause 
    

    now drag the [parent folder] to rename_icons.bat

    . . . . A VERY IMPORTANT NOTE:

    This is very powerful that it may affect neighboring folders

    (in other words it works but too well and someone smarter can fix it)

    for the time being, MAKE SURE THAT [parent folder] is the only folder in the directory

  • Related Question