Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Is Outlook running? (2003 SP1)

    Does anyone know how I can determine whether Outlook is running via a DOS batch file?

  2. #2
    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: Is Outlook running? (2003 SP1)

    Wow, and I was just going to say I thought it required VBScript... The next time I have a ghost Outlook (no visible Windows) in my processes tab, I'm going to try this out.

  3. #3
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    <hr>If you're running windows XP, you can use something like <hr>
    Excellent! Thanks, Rory!

  4. #4
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    tasklist doesn't seem to exist in XP Home - and I cannot find it on the distribution disk either

  5. #5
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    My version of XP Home seems to be convinced otherwise - either in cmd or via run <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Is Outlook running? (2003 SP1)

    Andrew,
    I only have Pro so can't test but are you sure? Microsoft seem to be fairly convinced that it does exist in XP Home.

    Later edit:
    I have checked the XP Home install directory on my MSDN DVD and you appear to be correct - there is no Tasklist.ex_ in there (unlike on the Pro setup). It also does not appear to be included in the Support or Valueadd directories. Perhaps they forgot. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15> For Home users, I guess you would have to use one of the other options I mentioned
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Is Outlook running? (2003 SP1)

    Andrew,
    I actually just edited my post to confirm that you are right and MS appears to be wrong!
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Is Outlook running? (2003 SP1)

    Hi,
    [Edited to note that Tasklist only exists on XP Pro, not Home Edition, with thanks to Andrew for pointing that out! - Rory]

    If you're running windows XP Pro, you can use something like:
    <pre>set Outlook_Running = No
    tasklist | find "OUTLOOK.EXE">NUL
    if NOT ERRORLEVEL 1 set Outlook_Running = Yes
    </pre>

    which will set an environment variable called Outlook_Running to Yes or No. If you're not on XP Pro, you may have to find another program that lists running processes and substitute its name for tasklist in the above - e.g. there's TList on the Win2k CD or PuList which can be downloaded from the MS site.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  9. #9
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    Hi Rory -- thanks again for helping me determine whether Outlook is running. If I may, I've a subsequent question. If I find that Outlook is running, is there a command line I can add to the batch file telling Outllook to properly exit/close?

  10. #10
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    <hr>The ugly way to do it (and I'm assuming you are doing this for the reason Jefferson mentioned - i.e. you have an invisible Outlook process left running), would be to change the last line to<hr>
    I'll give that a try a little later. My batch file is for backup purposes (Outlook PST / rules / view_options / signatures / etc. and other data files on the PC), so the files can't be in use.

  11. #11
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    <hr>The ugly way to do it <hr>
    I still haven't gotten to this yet, but is there a more elegant way to do this (rather than "ugly")? What I mean is instead of killing the process, is there a command that I can issue that will mimic File/Exit, ensuring data integrity?

  12. #12
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Is Outlook running? (2003 SP1)

    Not that I am aware of though you may be able to find third party apps that will enable that from a command line. Failing that, you could probably write a vbscript to do it and run that from the batch file using cscript.exe?
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  13. #13
    Star Lounger MarkAtHome's Avatar
    Join Date
    Feb 2001
    Location
    New Jersey, USA
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Is Outlook running? (2003 SP1)

    <hr>Not that I am aware of though you may be able to find third party apps that will enable that from a command line. Failing that, you could probably write a vbscript to do it and run that from the batch file using cscript.exe? <hr>
    DOS batch files, I'm fine with, but vbscript is greek to me. :-(

  14. #14
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Is Outlook running? (2003 SP1)

    Mark,
    Try the attached. Save it as StopOL.vbs in the same directory as your batch file, then change the last line of the batch file to read:
    <pre>if NOT ERRORLEVEL 1 cscript.exe //nologo StopOL.vbs
    </pre>

    and that should work.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  15. #15
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Is Outlook running? (2003 SP1)

    The ugly way to do it (and I'm assuming you are doing this for the reason Jefferson mentioned - i.e. you have an invisible Outlook process left running), would be to change the last line to:
    <pre>if NOT ERRORLEVEL 1 taskkill /F /IM outlook.exe
    </pre>

    Again, I'm assuming you have XP Pro, otherwise you may need to download a copy of kill.exe or a similar program. Edit: I think tskill.exe comes with XP Home. - Rory
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

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
  •