Click here to Skip to main content
15,846,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a little collection of movies placed in folders. I placed movie poster in each folder, and recently, I placed an icon (converted from that poster thru a software) in each folder, and i want that each folder will look from the icon placed in each of them.

Is there a .bat file, or any means of doing it faster, instead of going thru folder attributes individually?

please help. icon file is named "icon.ico" Each folder contains: movie.mp4; movie.nfo; poster.jpeg; Trailer.mp4; icon.ico.

thanks in advance.

What I have tried:

@echo off
set O=desktop.old
set F=desktop.ini
FOR /R %%I IN (*.ico) DO @(
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 ..

by squilibob, but is not working for me
Updated 16-Nov-18 8:44am
CHill60 16-Nov-18 8:00am    

1 solution

@CHill60 thanks for the reply. I tried

If [%1] == [] goto :eof
ECHO [.ShellClassInfo] >%1\
ECHO IconResource=C:\icon.ico,0 >>%1\
move %1\ %1\desktop.ini
attrib +S +H %1\desktop.ini
attrib +R %1

but may question is this if I may, in the code the location of icon is at C:/icon.ico.
What will I input instead as the location of icon file, since the icons are located inside individual folders, and it's named as "icon.ico"..
Thank you so much..

PS. I also tried
If [%1] == [] goto :eof
ECHO [.ShellClassInfo] >%1\
ECHO IconResource=%1\icon.ico,0 >>%1\
move %1\ %1\desktop.ini
attrib +S +H %1\desktop.ini
attrib +R %1

but still not working.

Share this answer
Richard Deeming 20-Nov-18 9:36am    
If it's "not working", then why have you posted this as a "solution"? And why have you accepted this "solution" as the answer to your question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900