Posts

Showing posts with the label dos

HOWTO: Delay autostart of a program with batch file

If you shoot at mimes, should you use a silencer?   - Steven Wright This is kind of an interesting little exercise that came from our eggheadcafe.com forums and I thought I’d write it up for posterity: User has some sort of logging program (not a service) that depends on SQL Server being up and running in order to do it’s work. Problem is, the little proggie is starting to work before the SQL Server service does on bootup. So the user is asking how you can delay the start of the proggie. Being my helpful self, I advised him to write a .NET console app, have the app sleep the main thread for the specified time, and then use Process.Start to execute the real program. User responds that he doesn’t know what Sleep means; if only there was a way to do this with a batch file. Well, not to be daunted, I went out and did a bit of research. Turns out that there isn’t any native DOS command to “sleep” a batch file. The only way you could do it is to use something from one of the Window...