batch del everything around it except itself

September 30, 2010 at 04:02:49
Specs: Windows 7, 4gb
Hi! How would I write a batch file that will delete everything around it except itself? Like del *.* but not deleting itself.

See More: batch del everything around it except itself

Report •

#1
September 30, 2010 at 09:37:21
Oh, why not.
for %%a in (*) do if not "%%a"=="%~nx0" del "%%a"


Report •

#2
April 2, 2011 at 07:07:03
for %%a in (*) do if not "%%a"=="%~nx0" del "%%a" works cool for me, but
how can i remove user input request?

Report •
Related Solutions


Ask Question