none
Help with killing outlook RRS feed

  • Question

  • Hi guys,

    Been trying to sort this issue out but im having no luck....PLEASE HELP!

    So i have a deployment tool which installs some software however it needs Outlook to be closed. The below is the command. So basically if Outlook is open it kills the task and the install runs, HOWEVER when outlooks not running and it tries to kill the task it fails (because Outlook isnt running) and the install fails as it detects the error. So basically i need some kind of way of doing it that avoids the error (if dont exist go to end) sort of thing?

    @echo off
    tasklist /fi "imagename eq outlook.exe" > nul
    if errorlevel 0 taskkill /im outlook.exe
    else
    exit

    Monday, July 7, 2014 10:15 AM

Answers

  • It's not recommended to terminate the outlook.exe process, particularly in the case the customer has a connected PST file which can become corrupt.

    It is much better to fail the install if Outlook is running rather than terminating the process and possibly corrupting the customer's data.


    -- Bill Stewart [Bill_Stewart]

    Monday, July 7, 2014 4:59 PM
    Moderator

All replies

  • This is all you need:

    @echo off
    tasklist | find /i "outlook.exe" && taskkill /im outlook.exe  /F

    Monday, July 7, 2014 10:32 AM
  • If Outlook is not open and i run the command it just sits there which is no good, it needs to finish or the task wont continue.
    Monday, July 7, 2014 12:04 PM
  • If Outlook is not open and i run the command it just sits there which is no good, it needs to finish or the task wont continue.

    I think you are not reporting the full story (or not posting the full batch file). Here is what happens when I run the command I suggested:

    d:\>tasklist | find /i "outlook" && taskkill /f /im outlook.exe
    d:\

    As you see, it does not sit and wait!

    Monday, July 7, 2014 2:01 PM
  • It's not recommended to terminate the outlook.exe process, particularly in the case the customer has a connected PST file which can become corrupt.

    It is much better to fail the install if Outlook is running rather than terminating the process and possibly corrupting the customer's data.


    -- Bill Stewart [Bill_Stewart]

    Monday, July 7, 2014 4:59 PM
    Moderator
  • Try: 

    wmin process where "name='outlook.exe'" delete

    Wednesday, September 25, 2019 7:12 PM
  • I refer the honorable gentleman to the marked answer to this question, which was marked as answered more than 5 years ago.

    -- Bill Stewart [Bill_Stewart]

    Thursday, September 26, 2019 4:04 PM
    Moderator