A Batch script to email when it fails a task

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
abasto
Posts: 1
Joined: 15 Sep 2016 16:37

A Batch script to email when it fails a task

#1 Post by abasto » 15 Sep 2016 16:43

How can I create a batch script and make it run at or after 9 pm. Where it would
1. Run a Ccleaner
2. Run updates.
3. Run a malware Byte
4. And clear out temps.
5. Do disk frag
and lastly
6. Restarts and also sends out output to an email and also email if a task fails.
Is this something that can be done with cmd and put it as a batch file?
I just registered here so I don't know what you guys can help out here on this.
Thank you so much

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: A Batch script to email when it fails a task

#2 Post by foxidrive » 25 Sep 2016 19:51

abasto wrote:How can I create a batch script and make it run at or after 9 pm.


You'd use task scheduler for that. There is a command line tool to create tasks as well.
Where it would
1. Run a Ccleaner
2. Run updates.
3. Run a malware Byte
4. And clear out temps.
5. Do disk frag
and lastly
6. Restarts and also sends out output to an email and also email if a task fails.

Each task requires batch commands, but the exact commands needed depend on the task itself.
You've shown general tasks and they aren't clear.

Is this something that can be done with cmd and put it as a batch file?

Yes, that's what scripts are most useful for.

The progams being used need command line switches to do their job of course. Some programs don't have the capability to be scripted.

ShadowThief
Expert
Posts: 1163
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: A Batch script to email when it fails a task

#3 Post by ShadowThief » 25 Sep 2016 21:58

The current version of MalwareBytes does not support command line arguments, so your task cannot be automated they way you've written it.

Post Reply