Discussion Locked

Batch file for schedule task

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

Help!
How do you set a schedule task in Window95 environment for things like every Friday, do a defrag at 12:30pm, scandisk, empty recycle bin, auto shutdown at 6:00pm etc.. using a batch file?

9 replies

by mlee

You can use the Task Scheduler that comes with Windows. Usually comes up at bootup or it will be in Start > Programs > Accesories. That might help you in what you are trying to do.

Mike

by atiugk

Thank you for your reply. I know about this 'Task Schedule' that comes with Windows but I need to know how to use with a batch file.

by mikulush

To add to the previous answer, if the task scheduler is not installed, you can install it by installing IE 4.0 or later and making sure you select the Task Scheduler option during the install.

by atiugk

Thank you for your reply. I know about this 'Task Schedule' that comes with Windows but I need to know how to use with a batch file.

by mservino

As much as I hate to answer a question with a question... Why would you want to do a defrag, or scandisk in the middle of the day?

These are intesive applications that would seriously undermine anything else the machine is doing.

Aside from that you can't empty the recycle bin from a batch file. The batch file will only allow you to ron dos type commands, and that one isn't generally available in win95, you would need an add on like cleansweep or the like for that.

setting the batch file is fairly simple though, you can set each task to run from it's own or you can set them up one after the other in a single batch file. If you need the code let me know and I'll get you an example.

As far as scheduling goes, as mentioned before you need to have scheduler installed and enabled. If you don't then go ahead and load it. The help files will do a decent job of walking you through setting up a task to run on schedule.

There are also some off the shelf products that will allow you to do some of the same things without the batch file and scheduler,
Diskeeper will do defrag on a shcedule as assigned, there are others that can do more as well.

As I am not a big fan of Microsofts, Scandisk and Defrag in Win95 I would recommend looking into one of these off the shelf packages. Win98SE & Win2000 have vastly improved versions of the utilites and you may want to consider upgrading your OS.

Hope this provides some help and insight.
-Mike

by atiugk

Your reply does give me an insight of what batch file can do and cannot do in Window 95. If it does not give you too much trouble, could I have an example and the code? Thank you.

by it-sage (bschirf)

If I understand you correctly, your original question was "How can a batch file run some special task at some preset time?" Right?

The answer is, if you're referring to good ol' DOS batch language then you're SOL. The DOS batch language that comes with Win95 does have a way to put itself to sleep until a preset time of day, or even a preset time has passed since the batch was started.

The best you could do is find a way to execute these tasks via a batch file (many that you mentioned can't) and then use the built in scheduler to launch the batch file.

Or, you can look into VBS (See: MS KB) This is much more powerful and flexable, but requires a lot more programming knowledge.

HTH...

by atiugk

Your reply does give me an insight of what batch file can do and cannot do in Window 95.

This discussion is closed to new replies.