Help Running Startup Programs From A Batch File

Ok, I’m trying to run programs on startup, but delayed like five minutes.

My batch file is below. The problem is that Comodo firewall starts up, but the batch file stops there. It never reaches the next sleep command. What can I do? The “start” command just loads another command window.

sleep 400

call "C:\Program Files\Antivirus\Comodo\COMODO Internet Security\cfp.exe" -h

sleep 240

call "C:\Program Files\IM\Pidgin\pidgin.exe"

sleep 240

call "C:\Program Files\Skype\Phone\Skype.exe"

sleep 240

call "C:\Documents and Settings\username.xxxxx\Local Settings\Apps\2.0\Q17X5GYY.R7J\Y8MVYJ0E.2W4\gvno..tion_69c30141a010d97c_0001.0001_881f294e3e425ed4\"

sleep 240

call "C:\WINDOWS\system32\PDesk\PDesk.exe" /Autolaunch

sleep 1200

call "C:\Program Files\MyDefrag v4.2.7\Scripts\OptimizeDaily.MyD"

  1. Well… I’m no coder, so no help there.
    But, if you’re more concerned with the results than the process.

You might enjoy this little app, Startup Delayer.


Try using

start “executable name” /w

The “/w” causes the script to wait untilthe executable has completed before executing the next line.

Ewen :slight_smile:

How did you learn all that? :stuck_out_tongue:

That could be useful for something I had made. Hmm…

Hi Guys,

In addition to what panic pointed

Well written programs usually are setting the Return or Result Code depending on the logic and the situation / circumstances of Exit[ing]

You can control and branch the batch or the script by analyzing that “Code”
using “IF ERRORLEVEL” (in the batch file)…

That’s very helpful stuff, but again - the program should be written properly and all available Result Codes (the meaning) should be declared in the documentation

The main purpose of the remark is - waiting for the executable being completed is necessary, but then probably the execution may’ve ended unexpectedly / with the error / or in a normal manner but depending on the passed parameters,

so it may happen that is not a good time to “Sleep”/delay but rather “Wake up and Run!!!” ;D


Time and experience Jeremy - there’s no substitute unfortunately. :wink:

Sure there is, it’s called google, lol ;D

But seriously, I couldn’t find this in Google, so I asked here. Thanks for all the good answers.

panic, I actually want comodo to start, then go to the next line right away (which is the sleep program), then load pidgin, then skype, catch my drift? These are programs I don’t want to exit.

You should not use CALL, as CALL is supposed to call a secondary batch file, closed by EXIT: prefer START.

Depending upon the OS you are using, SLEEP is not automatically implemented: SLEEP is part of the 2003 Resource Kit where it is supposed to be download from; to make sure, go to the Dos prompt and, assuming the SLEEP executable is under the path, type:

If SLEEP does not work, the same can be accomplished by CHOICE:

CHOICE /c:YN /n /t:Y,20
where c provides silent execution and 20 is the number of seconds until the default choice (continue) occurs.

The last alternative, outside dedicated utilities, is to ping the localhost:

PING -n 20
for 20 seconds.

The “/w” doesn’t wait for the execuited program to finish, just to complete loading.

Ewen :slight_smile: