Using the DEL(alias for ERASE) command, one can remove files.
@echo off
del foo.ext
This command will delete foo.ext from the current directory. One can also specify path and file, such as:
del C:\Foo\Bar\Baz.ext
But it is always ideal to put quotes (") around paths, see here for the reason.
There are a few flags available for DEL.
| Flag | Function |
|---|---|
/P | Prompts user before deleting file(s) |
/F | Forcefully remove read-only file(s) |
/S | Remove file(s) in subdirectories |
/Q | Prevents the user prompt |
/A | Filter: Only remove specific attributed file, |
using the - character means not attributed as that type. |