I want to be able to open Thunderbird from a batch script in Windows. I can do it just fine from command line:

C:\>"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"

If I create a batch script that looks like this:

"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"

and execute it from the command line:

C:\>t.cmd
C:\>"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"

Thunderbird opens, but the script halts (it does not exit).

If I close Thunderbird by hand, the script exits.

It has been a while since I have used batch scripts. Am I doing something wrong?

Edit: script exits just fine if Thunderbird is already opened. Strange.

link|improve this question

75% accept rate
feedback

3 Answers

up vote 3 down vote accepted

Try

start /d "C:\Program Files\Mozilla Thunderbird" thunderbird.exe

link|improve this answer
Thanks! Works great. :) – Željko Filipin Nov 27 '09 at 14:03
feedback

As Systech suggests, the start command is what you are looking for to run the program and not wait for it to terminate before continuing.

The reason you see different behaviour when Thunderbird is already running is that it is only allowing one copy to run. The second copy detects the first and gives it focus before going away (so effectively immediately returning control to your batch script). If you were calling an application that allows multiple instances of itself to run (something as simple as notepad would do if you want to test this to see for yourself) you would not see that difference in behaviour.

link|improve this answer
feedback

The reason the script stalls is because it's waiting for Thunderbird to complete and return control to the batch file.

You need to use the "/d" option as Systech suggests.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.