Writing a self deleting batch file
Posted by trm96 | Filed under How-to, MS DOS/FreeDOS
Some people laugh at me when I tell them I love to write batch files.
Today i found myself in kinda a pickle, I wanted to write a batch file that would delete itself as well as any files in the directory it was located in. So I turned to my good friend Google, not too much luck… Lucky I can usually figure this stuff out. Here’s what worked for me…
The solution:
@echo off
cls
del. /q
the del. deletes everything in the working directory and /q switch makes it so you don’t have to confirm every file delete (quite mode).
I hope this info was helpful!
Tags: batch file, Windows









