Automatically Drop Delete Database Using WindowsTask Scheduler

To automatically drop delete a database using WindowsTask Scheduler, you can use the following steps:

  1. Open Task Scheduler
  2. Please create a new task and configure its trigger to run at a specific time/frequency as desired
  3. In the “Action” section, choose “Start a program” and set the program/script path to “dropDatabase.bat”.

The following bat Script I have given below:

REMOVE files backup older than N days
forfiles /p "D:\Live_DBBakup" /s /m *.* /c "cmd /c Del @path" /d -number of days

Example :

REMOVE files backup older than 7 days
forfiles /p "D:\Live_DBBakup" /s /m *.* /c "cmd /c Del @path" /d -7

Step01: Open Task Scheduler

Step02: Create a Schedule Task according to image

Step03: Provide a Schedule Task Name on Name Field Section –

Step04: Create Triggers for the specific task –

Step05: Create a Schedule for the new task –

Step06: Create a Action for the specific task –

Step07: Put your bat file following path location –

Step08: Provide windows server authentication for creating a schedule task –

Leave a Comment

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

Scroll to Top