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.

FlagFunction
/PPrompts user before deleting file(s)
/FForcefully remove read-only file(s)
/SRemove file(s) in subdirectories
/QPrevents the user prompt
/AFilter: Only remove specific attributed file,
using the - character means not attributed as that type.