Search This Blog

Thursday, November 19, 2009

delay open file when startup with batch files

I have come across a need to start 2 application during window start up by sequence. The 1st application i call it App1 (C:\application\App1.exe) and the 2nd one i call it App2 (C:\application\App2.exe). Check the below script, REM mean comment in command prompt.

REM set command display to off
@echo off

REM start application App1.exe
START C:\windows\notepad

REM wait for 5 seconds
PING -n 5 localhost > nul

REM start application App2.exe
START C:\windows\notepad

REM exit batch after finish

To test it, Open window notepad. Copy and paste code above to the notepad and save as "start.bat". To make it simple for testing, i have change C:\application\App1.exe to C:\windows\notepad and C:\application\App2.exe to C:\windows\notepad.

Double click on start.bat and you can see the batch file in action.

Hope this help.

No comments: