Sunday, June 27, 2010
Create a Changing Pen Drive Icon
Create a Changing Pen Drive IconTo do this in an easy way we need 10 icon files. After gathering up all ten icons rename them to core(0-9).ico like:
Now, create a folder named “icons” on the top of the Pen Drive directory (root) and copy the icons on it.
First make sure that file extensions are showed up and to do this Click on Tools > Folder Options > View and uncheck the box saying ” Hide extensions for known files“.
Now Right Click on the Pen Drive’s folder and choose new>Text Document and name it icon.bat . Click OK for confirmation file extension change.
Open the file with notepad and copy the following lines:
@echo OFF
set num=%random:~-1%
ATTRIB -r -h Autorun.inf
del Autorun.inf /f
echo [autorun] > Autorun.inf
echo icon=icons\core%num%.ico >> autorun.inf
echo open=icon.bat >> Autorun.inf
echo shellexecute=icon.bat >> Autorun.inf
echo shell\auto\command=icon.bat >> Autorun.inf
echo shell\open\command=icon.bat >> Autorun.inf
ATTRIB +r +h Autorun.inf
explorer.exe \
exit
Double Click on the icon.bat file and a hidden autorun.inf file will be created and it will contain something like:
But if you double click on the file icon.bat again it may look like:
As the Autorun.inf file responsible for the icon replacement you should notice the only change in the pictures that core5.ico is changed to core4.ico. So as many times the icon.bat file is accessed the icon name will change giving you a changing icon.
When you Plug In your Pen Drive, the icon.bat file will be accessed if autorun is enabled or if you choose Auto or Open options on the right click menu of the drive it will also open the icon.bat file, resulting the change in icon name assigned with the Autorun.inf file.
Hope it helps and dont forget to open the icon.bat file after saving it otherwise it will not create the Autorun.inf file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment