|
Answer» I need a Batch file to start 3 applications. I've tried the FOLLOWING in a batch file:
Code: [Select]"C:\Program Files\Windows Live\Messenger\msnmsgr.exe" "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" It starts the first one; Messenger, and stops there.
How can I get it to proceed to execute the remaining applications? Ideally each one should only start after the previous one has successfully started, but it is not an absolute requirement. Oh, and all this must be silently. No input required to process the next line.
Thanks in advance.Try the following:
Code: [Select]@echo off start "" "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" start "" "C:\Program Files\Mozilla Firefox\firefox.exe" start "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"Thank you, that works
Is there a way to delay processing the next line, e.g
Code: [Select]start "" "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" wait 10 seconds then proceed start "" "C:\Program Files\Mozilla Firefox\firefox.exe" wait 5 seconds then proceed start "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" You could have a look here: http://malektips.com/xp_dos_0002.htmlCode: [Select]start "" "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" ping -n 1 -W 10000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Firefox\firefox.exe" ping -n 1 -w 5000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"Quote from: devcom on JULY 28, 2008, 09:16:05 AM Code: [Select]start "" "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" ping -n 1 -w 10000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Firefox\firefox.exe" ping -n 1 -w 5000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" I had something like that but I couldn't find it. Thanks. Quote from: Carbon Dudeoxide on July 28, 2008, 08:58:25 AMYou could have a look here: http://malektips.com/xp_dos_0002.html
Quote from: Carbon Dudeoxide on July 28, 2008, 09:17:22 AMQuote from: devcom on July 28, 2008, 09:16:05 AMCode: [Select]start "" "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" ping -n 1 -w 10000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Firefox\firefox.exe" ping -n 1 -w 5000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" Much appreciated Thank you.
I did download the Windows Server 2003 RESOURCE Kit Tools, and the Sleep command works. I'll save the second method for when I reinstall Windows and don't need the Windows Server 2003 Resource Kit Tools. Fair enough. Quote from: devcom on July 28, 2008, 09:16:05 AMCode: [Select]start "" "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" ping -n 1 -w 10000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Firefox\firefox.exe" ping -n 1 -w 5000 1.1.1.1 >nul start "" "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" I would highly discourage anybody from issuing a PING command on something they don't have control over without a reason. I like to write code as clean and polite and portable as possible. Why not ping 127.0.0.1 or localhost INSTEAD of 1.1.1.1? It would be less work for the computer, more predictable results, and it is more portable and more polite.
Just my 2 cents.By using 127.0.0.1, the 'timer' doesn't work at all.Quote from: Carbon Dudeoxide on July 28, 2008, 06:22:48 PMBy using 127.0.0.1, the 'timer' doesn't work at all.
That depends on the syntax. Using 127.0.0.1 is actually much more accurate than using an IP address you don't control. With 127.0.0.1 you know that it will reply (unless you have done something to disable this), and since I assume you don't control the IP address 1.1.1.1 then you don't really know if it will respond to an inbound ICMP echo request or not ... or when it will change. So knowing that 127.0.0.1 (or localhost) will respond, just use: ping -n (seconds+1) 127.0.0.1
So if you want to pause for 5 seconds, use: Code: [Select]ping -n 6 127.0.0.1 >NUL This works because the first count will be instant, and the others will follow at 1 second intervals.
|