Using the following line in a batch script to call thunderbird and compose an email:

thunderbird.exe -compose "to='email@domain.com',subject='Some Subject',preselectid='id1',body='Message Body',attachment='File.txt'"

The command performs perfectly fine, however the batch script will not continue until the application terminates. Is there a way to bypass this so that the script will continue on with the next command?

share|improve this question
    
possible duplicate of Invoke EXE from batch file without waiting – CharlesB Jun 6 '11 at 15:06
up vote 3 down vote accepted

use start /b before the command, and the batch script will continue to execute after launching the process.

share|improve this answer
    
Off-note: Is there a difference between running a program directly (e.g. CMD C:\Some\Program.exe) or with the START command with a /WAIT switch? – Mechaflash Jun 6 '11 at 16:33
    
Doesn't the /b switch hide the application? "Start application without creating a new window"(via cmd START /?) – Mechaflash Jun 6 '11 at 16:35
    
Good question, don't know the difference. start opens a console window which is not what you want, hence the /b flag – CharlesB Jun 6 '11 at 16:40
    
START /B works well for this. Just a note however, if you are referencing the absolute path (e.g. C:\Program Files\Mozilla Thunderbird\thunderbird.exe -compose "to='email@domain.com',subject='Some Subject',preselectid='id1',body='Message Body',attachment='File.txt'") It will fail because a path with spaces requires quotations, but the Thunderbird command line arguments requires quotations as well so you receive an error. Thanks Charles – Mechaflash Jun 6 '11 at 17:55
    
@Mechaflash to avoid this you can CD into C:\Program Files\Mozilla Thunderbird before calling start, now without absolute path (nor quotes) since thunderbird.exe is in this directory – CharlesB Jun 6 '11 at 17:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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