Tuesday, October 4, 2011

Creating an autorun.inf folder with batch file

There are an article about creating an autorun.inf folder on your USB drive’s root directory to prevent viruses from creating its own malicious autorun.inf file on your USB drive.

Unfortunately, once your computer is infected, it’s quite difficult to create the folder. If you have successfully deleted the infected autorun.inf file, the malware would simply recreate that file immediately before you are able to create the folder. This prevents you from creating the autorun.inf folder giving you an “A subdirectory or file autorun.inf already exists” message.

The process of deleting the file and creating the folder must be done as quickly as possible. But for some who can’t do this quickly, you’ll need a batch file. Copy and paste the following code into a new text file, rename it as mkautorun.bat or anything you want with .bat extensions. Copy it to your root USB drive and run it from there. It will delete the existing autorun.inf file and replace it with the folder. It also creates a CON folder inside the folder.


@echo off
cls
attrib autorun.inf -r -h -s
del autorun.inf
md autorun.inf
cd autorun.inf
md .\con\
cd\
attrib autorun.inf +r +h +s
echo.
dir autorun.* /a
echo.
echo DONE!
Pause

No comments: