Discussion Locked

creating schedule tasks

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can anyone teach me how to create a schedule task that runs on a scheduled time and day which allows me to delete unwanted files from a folder.

thanks and regards,

9 replies

by skitzizzy

First you will need to write up a batch file to delete the files in the directory you want. Save the batch file to a convenient location, probably in the folder you wish to clean.

Then go to your control panel, select Schedule Tasks and set up the task scheduler to run the batch file at a specified time.

by skitzizzy

Open notepad and type something along the lines of:

REM This script deletes files from C:\test
cd \
cd test
del testfile.txt
pause

Save the file as filename.BAT or filename.CMD. If you want to delete all files of a particular extension type, use del *.txt

If you want to delete all the files, use del *.*

Hope that helps you

by choy.waigiat

this script works. But it will prompt me to answer Yes or No to delete the files. Is it possible that the script do it automatically without me pressing Y to delete and after it has finished the tasks, the box will close by itself.

by skitzizzy

You can query what switches an executable uses by opening the a command line and typing filename /?. In this instance, use del /?

But as you ask, to do it in quiet mode, use the /q switch...ie:

del *.txt /Q

I thought del will only prompt if you use the /p switch as well? Oh well.

This discussion is closed to new replies.