Posted by SpywareDr on May 23, 2011 at 19:07:40:
In Reply to: dos posted by kotresh on May 20, 2011 at 14:29:21:
: HOW to delete "autorun.inf" file but not
: "autorun.inf" folder ?
:
: My batch file aim is :
: 1. To Check whether any file "autorun.inf" is
: present or absent
: 2. If present then i should delete it
: (forcefully deleting even if its read only)
: If there is a folder by name "autorun.inf" it
: should skip deleting
:
: I'm struck-up in differentiating between file
: and folder.. ?
I believe the following single line solution does everything you ask:
@echo n|del /f autorun.inf
It will remove a file named "autorun.inf" in the current directory, even if it has the read-only file attribute set, but yet will not delete, or remove anything within, a subdirectory of the current directory named "autorun.inf".