Windows 10

Batch File To Delete A File If Exists

In this tutorial, we are going to see how to delete a file if exists in a batch file by using IF EXIST condition. Batch file contains a series of DOS (Disk Operating System) instructions. It allows triggering the execution of commands found in this file.
 

Batch File To Delete A File If Exists

 

 

@echo off

IF EXIST file.txt DEL /F file.txt

Output:


 

Leave a Reply

Your email address will not be published. Required fields are marked *