1

How can i make a .bat file that automatically changes the icon of a folder to the icon present in the current directory ie - "transprent.ico" ?

asked May 28, 2014 at 11:06

3 Answers 3

3

You can do this changing Desktop.ini file

@echo off
set /p "fld=Folder: "
set /p "ico=Icon file: "
md "%fld%\icons" 2>nul
if exist %ico% copy "%ico%" "%fld%\icons\icon.ico" /y 1>nul
attrib -h -s "%fld%\desktop.ini" 2>nul
(
echo/[.ShellClassInfo]
echo/IconResource=icons\icon.ico,0
) > "%fld%\Desktop.ini"
attrib +h +s -a "%fld%\Desktop.ini"
attrib +r "%fld%"
attrib +h "%fld%\icons"
taskkill -im explorer.exe /f >nul&start explorer
answered May 28, 2014 at 12:57
Sign up to request clarification or add additional context in comments.

Comments

2

I have this batch file I created. Put it in the parent folder of all the folders that you want to search through. This version looks for a PNG with a matching name to the ICO file but you can edit that part to make it only do an ICO file it finds, if you like. It will make a copy of your old desktop.ini file as well but that is also you can edit optionally.

@echo off
set O=desktop.old
set F=desktop.ini
FOR /R %%I IN (*.ico) DO @(
cd%%~pI 
if exist %%~dpnI.png (
echo %%~dpnI.png
attrib -h -s %F% 
copy /Y %F% %O%
echo [.ShellClassInfo] > %F%
echo IconResource=%%~nxI,0 >> %F%
echo [ViewState] >> %F%
echo Mode= >> %F%
echo Vid= >> %F%
echo FolderType=Videos >> %F%
echo Logo=%%~nI.png >> %F%
attrib +h +s %F% 
)
)
cd ..
answered Sep 18, 2014 at 9:41

Comments

0

I know this is not the exact solution you look for but, still is a workaround

1.install theinpaint/FolderIco

2.add the path of FolderIco.exe to your environment path

3.create your batch file as follows :

FolderIco -f "[path to your directory]" --icon "path to your .ico file"
answered Jun 16, 2020 at 14:42

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.