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

Step01

Step02: Create a Schedule Task according to image

Step02

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

Step03 ConfigureAnd CreateTaskName 1

Step04: Create Triggers for the specific task –

Step04 CreateTriggureForSpeceficTask 1

Step05: Create a Schedule for the new task –

Step05 SetTriggareForSpeceficTask

Step06: Create a Action for the specific task –

Step06 CreateActionForSpeceficTask 1

Step07: Put your bat file following path location –

Step07 InsertActionScript 1

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

Step08 ProvideWindwosAuthenticationPassword 2

Leave a Comment

Scroll to Top