I need to delete a specific file every 2 weeks. The file is: C:\Logfile.txt

I thought I could use Windows Task Sceduler to do this, but there seems to be no option to create a 'Delete File' task.

Can someone help with this please?

Cheers for all help

  • 3
    Start deletion as a command: cmd /c del C:\Logfile.txt. Or start any script/program which performed this task.
    – Akina
    Commented Jul 29, 2019 at 13:05

1 Answer 1


As @Akina's comment states, you'll either want to use the del command directly:

cmd /c del /f /q "C:\Logfile.txt"

or via a batch file your scheduled task would point to:

@echo off

del /f /q "C:\Logfile.txt"


Either way, I would likely include the /f to ignore the read-only attribute and the /q avoid a confirmation prompt - this way nothing should hang the task up.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .