Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Starting Outlook from a batch file  (Read 59920 times)

0 Members and 2 Guests are viewing this topic.

Yaro67

    Topic Starter


    Rookie

  • Certifications: List
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Starting Outlook from a batch file
« on: July 15, 2008, 09:51:05 AM »
SO I have a issue with Outlook.  Every so often it comes up with a error that says the administrator has made a change and you need to restart Outlook for it to take effect.  But as far as I can tell there has been no changes.  The problem is I can't access other email account I have been granted to after that until I restart. So I figured instead of wasting time doing research or reloading office or at the far reach my system which I know I need to do anyway I would write a batch file to kill outlook and reopen it.  Simple enough...

taskkill /IM Outlook.exe /f

"%ProgramFiles%\Microsoft Office\Office12\outlook.exe"

EXIT

That's the basic jist of it...

My questions is why does the command window hang open after it reopens outlook and does not continue on to the exit?  And does anyone know how to fix it so it will close or continue on to the exit?

Thanks
« Last Edit: July 15, 2008, 10:03:36 AM by Yaro67 »
Call me Ishmael

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Starting Outlook from a batch file
« Reply #1 on: July 15, 2008, 01:51:28 PM »
You'd be surprised how many examples of the start command are posted when it is not needed or even helpful. Finally a request comes along where a start will actually be the solution.

Code: [Select]
taskkill /IM Outlook.exe /f
start "" "%ProgramFiles%\Microsoft Office\Office12\outlook.exe"
EXIT

Without the start, the batch file is waiting for Outlook to terminate before the exit instruction is executed. The start command runs Outlook in separate process, so the batch file can continue on to the exit.

Good luck. 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

Yaro67

    Topic Starter


    Rookie

  • Certifications: List
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: Starting Outlook from a batch file
« Reply #2 on: July 16, 2008, 06:45:15 AM »
Thanks that definitely remember the "start" command in the future!   ;D
Call me Ishmael

blastman



    Hopeful

    Re: Starting Outlook from a batch file
    « Reply #3 on: July 16, 2008, 06:50:18 AM »
    just to add...

    if you close outlook by killing the process you might have to wait a few secounds before starting it again. In my experenice...

    To get round this add "ping localhost > nul" after the kill and before the start to pause the script for a bit.

    You might also find that outlook will do the "Checking personal folders for errors" at start up, and if you're like any of my users that will take a while as there PST files are huge!!

    Hope it helps.

    Blastman, you are the man. Thank You Very Much!!!!!!!!!



    Yaro67

      Topic Starter


      Rookie

    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: Starting Outlook from a batch file
    « Reply #4 on: July 16, 2008, 08:35:36 AM »
    You mean like...

    @ping 127.0.0.1 -n 5 -w 1000 > nul

    I learned that one a while ago seeing as their is no sleep command in batch.

    And as far as archives go we try and not let them get too unruly sense...
    1. Microsoft does not support running a archive from a network resource and...
    2. If it gets to big, say bigger then 2GB, then it starts really acting up.

    Thanks for your help!   ;)
    Call me Ishmael