Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Close Outlook from a .bat file (Windows XP/SP2 Outlook2003)

    Is there any way to close down Outlook 2003 from within a batch (.BAT) file? I run a batch file every night (using the standard Windows XP Scheduler to run unattended) to clean up stuff and back up all my data files (BackupPlus from Avantrix). If I fail to manually shut down Outlook before this run, the backup program notes that the .pst files are in use and skips them. This is not good. I checked the Outlook command line switches but did not find anything relevant. I tried to Copy and XCopy the files to temporary files but they're locked out of those commands also. Any ideas how to determine if Outlook is running, and, if it is, to shut it down?

    Thanks, John Littell

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,896
    Thanks
    0
    Thanked 86 Times in 82 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2 Outlook2003)

    See <post:=457,317>post 457,317</post:> - there are various options in that thread.
    HTH
    Regards,
    Rory
    Microsoft MVP - Excel.

  4. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Close Outlook from a .bat file (Windows XP/SP2

    What you actually need is a clean command-line method of terminating Outlook! (I didn't find one on a quick Google...).

    If you are feeling courageous or cavalier (or both!) you can use Sysinternal's PsKill in the simple form PSKILL OUTLOOK . If OUTLOOK is not running, then it doesn't kill it ... [doh!].

    But be aware of the possiblility of corruption of PST files, etc... Your Corruption May Vary...

    John

    PS Posted before I saw Rory's post above...!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  5. #4
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    Thank you for the replies, That referenced thread was an interesting conversation. I jumped into the middle and used the solution that had a "cscript.exe //nologo StopOL.vbs" statement invoking a script that defined an instance of Outook and then sent a Quit to it. It appeared to work as the copy that was open on the screen disappeared.

    But then a new problem; actually it seems that I've had it for some time but did not associate it with Outlook. After deactivating Outlook - either programatically or by the normal manual method - the task remains active permanently in the Task Manager list (Ctrl-Alt-Del). If I subsequently open a second copy and then close it, a second task is shown permanently open in the list. And a third, etc. The only way to clear them out seems to be to reboot. But then, during the task closing process of power down, for each copy of the Outlook task I receive an error window titled "MCI Command Handling Window" saying "This program is not responding" with instructions to click on "End now." Each instance of this error window clears out one copy of Outlook from the task list.

    As I said, I've had this problem for some time but did not know it was Outlook oriented. Please, how do I get rid of it?

    John

  6. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Close Outlook from a .bat file (O2003;WXPSP2)

    If you search for "recycle" on this board you hopefully will find some discussion on how to limit Outlook to starting a single session (in which you might have multiple windows but you should not have multiple entries in your processes list).

    Regarding StopOL.vbs, I think I wrote that a long time ago. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Now that we use Exchange rather than a POP server, there is another method (Logoff ?) that I think might be required or at least helpful to add before Quit, if it wasn't already in there. Not sure whether that applies to your situation.

    Also, there is some chance that if you clicked a mailto link in IE, your mail program might remain active until IE is closed. I haven't checked on that lately, but I think it happened in earlier versions of IE/Outlook.

  7. #6
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Close Outlook from a .bat file (Windows XP/SP2

    The writeup for PsKill <processname> indicates that it terminates all copies of <processname>. After Jefferson's program has run, perhaps see if PsKill does what you want?

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  8. #7
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    Jscher2000,
    Yes, you were part of a conversation back in March for which the Recycle switch was the solution, but the code that I copied was submitted by rory. That problem then was starting a second window of Outlook while a first copy of Outlook was already open. My problem now is that the first instance of Outlook has been manually closed (though it still shows up in the task list), and then a second instance of Outlook is started causing two processes to show in the task list. Specifically, this happens:

    1. Boot up Windows, Press Ctrl-Alt-Del to open the Task Manager window.
    2. Activate Outlook. (Click on actual .exe file; no special shortcuts involved.) Outlook.exe shows on screen and in the Task Manager window.
    3. Manually close Outlook. (The absolute normal way.) Outlook is off the screen but still shows as an active process in the Task Manager window.
    4. Activate Outlook. Outlook is on the screen and two lines of Outlook.exe show in the Task Manager window.
    5. Manually close Outlook. Outlook is off the screen but the two lines of Outlook.exe still show in the Task Manager window.
    6. Shut down Windows.
    6a. Window titled "MCI Command Handling Window" saying "program not responding", I click End now. One Outlook is gone.
    6b. Window titled "MCI Command Handling Window" saying "program not responding", I click End now. Other Outlook is gone.
    Now both Outlook processes are gone from the Task Manager window and Windows shuts down. During this experiment nothing else was done: IE was not activated nor was the default Filefox.

    I admit that the above digresses from my original problem; I consider that one solved. (See next message). I would still appreciate your thoughts on the above scenario as this is what is happening when using Outlook in a perfectly ordinary way.

    Thanks, John

  9. #8
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    JohnGray,
    PsKill does do what it advertisements. At the time I first used it, seven outlook.exe processes were shown in the Task Manager list as active (although all seven had been manually exited from the screen). "PsKill Outlook.exe" immediately wiped out all seven processes.

    Any other side issues to adding this to my cleanup batch file? Like will it flush any unwritten buffers before killing the application?

    John

  10. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    > will it flush any unwritten buffers before killing the application?

    Seem very doubtful.

    The strange window title (MCI something or other) suggests interaction with another program or process. Googling briefly doesn't give any clear answers, but perhaps some further investigation is in order before going to the brute force shutdown.

  11. #10
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Close Outlook from a .bat file (Windows XP/SP2

    There is 'something' wrong with this because you should only get one copy of Outlook.exe in the Processes tab of Task Manager per Outlook window you start and have currently available. If you close an Outlook window, then the corresponding Outlook.exe process should be terminated. (You know all this!).

    My concern with PsKill being used for removing Outlook processes is only that there might be corruption to mailboxes or PST files if you terminate a process at the wrong time. On the other hand, at home, it occasionally happens that Outlook Express 'hangs' and I try to start another instance, which of course doesn't work. Then I manually do End Process on the msimn.exe process(es), and simply get a "You didn't shut Outlook Express cleanly"-type message when I next start it up. I've never had any corruption of messages, to my knowledge. I can vaguely remember getting a "multiple copies of Outlook" problem on NT4 some years ago, but I can't remember what the problem was...

    I suppose it is a silly question to ask if you have applied all updates to XP subsequent to SP2 (clutching at straws!)?

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  12. #11
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,896
    Thanks
    0
    Thanked 86 Times in 82 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    Do you have any Outlook add-ins installed?
    Regards,
    Rory
    Microsoft MVP - Excel.

  13. #12
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    JohnGray,
    Your suppositions are correct. I know that only one Outlook process is supposed to appear in the Task Manager list. That's what is driving me crazy. And yes, SP2 and ALL updates to Windows and Office have been applied.

    Also yes, I agree that using something as violent and abrupt as FsKill is asking for corrupt .pst files. What I was thinking was to combine two of the techniques discussed earlier as follows:

    1. Invoke the script that Rory contributed back in the March thread to close Outlook politely. Here is the script:
    Dim oAppOL
    set oAppOL = CreateObject("Outlook.Application")
    oAppOL.Quit
    set oAppOL = Nothing

    2. Then run FsKill to clear out the Task Manager process list. I realize that this is only a rough work-around and does not solve the cause of the problem. So I'm still looking toe ideas.

    Thank you, John

  14. #13
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    rory,
    I was not even aware that Outlook had add-ins. So, looking into help and finding out that Outlook add-ins have an ECF extension, I searched and found that I have the following files: (Descriptions are copied out of Outlook Help)

    DLGSETP.ECF Delegate Access: Adds the Delegates tab to the Options dialog box (Tools menu)
    DUMPSTER.ECF Deleted Item Recovery: Adds capability to recover previously deleted items
    FAXEXT.ECF Microsoft Fax extensions: Enables extensions created for Microsoft Fax
    MSSPC.ECF Schedule+: Provides Microsoft Schedule+ compatibility
    OUTEX.ECF Remote Exchange Extensions: Adds Remote Mail settings to the Mail icon (Control Panel)
    OUTEX2.ECF
    PMAILEXT.ECF Windows CE Support: Adds Windows CE Inbox transfer support
    SCRPTXTN.ECF (Outlook Help lists Scrpxtn.ecf - Scripting Support...)
    fxsext.ecf (This is the only one in the Windows directory; all others in Program Files)

    Help says that they are installed automatically. I have no idea.

    John

  15. #14
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,896
    Thanks
    0
    Thanked 86 Times in 82 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    Under Tools-Options on the Other tab, there is a button called COM Add-ins. Select that and uncheck any add-ins that are listed. Then close Outlook and see if any instances remain in the task list.
    Regards,
    Rory
    Microsoft MVP - Excel.

  16. #15
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Close Outlook from a .bat file (Windows XP/SP2

    rory,
    I thought we had a winner. I saw that one add-in line was checked - AttachmentOptions - and unchecked it. Then I exited Outlook, looked at the Task Manager list, and it was gone.

    Then to make sure, I rebooted and performed the six steps listed above. Open and then close Outlook two times and, darn it, it's still in the task list two times. (I did go back to double-check the Com Add-ins section and verified that no add-ins were checked. Just two items are shown: AttachmentOptions and MailBuddy Outlook Addin, but their boxes are not checked.)

    Still hoping, John

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •