How do I write a batch file for a scheduled task?

Joemonkey

Diamond Member
Mar 3, 2001
8,859
4
0
Any ideas? I know I can write a batch file to open Outlook and use Task Scheduler to run it every 4 hours, but how do I write one that will let me close Outlook, wait 30 seconds or so, then re-open it?
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
what are you trying to do, check your email?


Just let it run minimized into the notification area. It's very low-resource when in the background like that. I have mine running all the time while I'm off playing 3d games.

You can use taskkill.exe if you want but there has to be a more graceful way to do this.
 

Joemonkey

Diamond Member
Mar 3, 2001
8,859
4
0
I wish it were that simple. This is in a law office environment, and this particular Outlook box has an addin that creates subfolders under the Inbox every time a specific type of email comes in. This could happen from 10 to 100 times a day. There is an option to "sort and trim" the inbox, but the option is broken. The addin itself is discontinued as well. So, the quick and dirty fix is to close outlook and reopen outlook, causing the program to do an automated sort and trim.

I figured it out, downloaded a utility from here to kill the process, then made my batch file look like this:

@echo off

c:
process -k outlook.exe

ping 1.1.1.1 -n 1 -w 30000 >NUL

"C:\Program Files\Microsoft Office\OFFICE11\outlook.exe"


I have it set to run every day at noon, which should be enough. Scheduled Tasks doesn't allow hourly or every x hour runs.
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
In that case I would setup a rule to handle things.

killing the process regularly isn't real healthy.
 

Joemonkey

Diamond Member
Mar 3, 2001
8,859
4
0
Originally posted by: Smilin
In that case I would setup a rule to handle things.

killing the process regularly isn't real healthy.

how is it any different than closing it? I understand I don't get the chance to save any opened documents, but this is outlook, and everything is happening on exchange, not locally.