Close Outlook from command line

G

Guest

I am writing a DOS batch file to automate NTbackup in Windows 2000
Professional. Outlook.pst won't back up if Outlook is running. I want to
close Outlook from a batch file so that NTbackup can back up the file.

I can use a freeware program called pskill.exe to close Outlook, but it
kills Outlook even if it is in the middle of downloading email, which seems
like a bad idea. Is there a command line option in Outlook that would close
the application after allowing it to finish all of it's processes?
 
K

Ken Slovak - [MVP - Outlook]

No but a couple of lines of script would do it.

Dim oOL
Set oOL = CreateObject("Outlook.Application")
oOL.Quit
 
G

Guest

Ken--

Looks great, but (please excuse my ignorence): how do I run this script from
a command line? I am using Windows 2K Professional.
 
R

Rick Newton

Put it in a .vbs file and run that from a batch file.

In the batch file use a call like this:

@echo off
cscript "<path_to_vbs_file>\CloseOutlook.VBS"
:EXIT

where you replace the <path> with the place you have saved the vbs
file, and similarly, change the script file name from CloseOutlook.VBS
to whatever you have named the saved file (the .VBS is required).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top