Outlook

I’m looking for a bat file to open outlook for a period of 20 minutes and after this time has passed to terminate outlook process.
Nick CollinsAsked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
In PowerShell it's similar:
$ol =New-Object -Com Outlook.Application
start-sleep 1200
$ol.Quit()

Open in new window

0
 
John TsioumprisSoftware & Systems EngineerCommented:
Oversimplified
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.run ("OUTLOOK.exe")
WScript.Sleep 1200000
objShell.Run "taskkill /f /im outlook.exe", , True 

Open in new window

0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
To kill Outlook is a bad idea, it can cause PST file inconsistencies. Rather a window close message or a Quit call to the Outlook object should be done. In VBS:
Dim ol
Set ol = WScript.CreateObject("Outlook.Application")
WScript.Sleep 1200000
ol.Quit()

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.