Order Tray | Contact Us | Home | SIG Lists

[aprssig] delay program

Keith - VE7GDH ve7gdh at rac.ca
Sat Jul 31 18:10:32 UTC 2004


Mike asked 29/07/2004 5:02:44 PM

> A while back there was some discussion on delaying start up programs used
> by AGW so that the packet engine would be fully loaded before the rest of
> programs were run.

Any reason you couldn't use a batch file to do the task? I'm pretty rusty with batch files, but I played around with it for a while and came up with something that worked all of the time in Windows XP Pro.. A search on Google should list quite a few sites with help on the syntax used in batch files. Some of the examples I found (using choice, sleep, timeout, etc.) didn't work. It looks like they would only be supported with various resource kits installed, or for CHOICE, a pre-XP version of Windows... I think. I kept trying to do it all in a single batch file, but kept running into snags depending on how many and which programs I was trying to start this way. By using several batch files and calling the others from the first batch file, it worked 100% of the time for me on my machine. 

@echo off
call program1.bat
PING 1.1.1.1 -n 3 -w 1000 > NUL
call program2.bat
call program3bat
call program4.bat
exit

For it to work, the IP address must be non-existent. You could play around with the numbers to make the time delay longer or shorter. This example starts one program, creates a delay, and then starts the rest of the required programs sequentially. You could create additional delays by inserting copies of the "ping" command in between the other batch files that are being called. The example should give you a 3 x 1000 ms delay after starting the first program before opening the rest of them. If you are working with a pre-XP version of Windows, you could use the choice command instead to introduce a delay.

My test file was C:\test.bat right in the root of the C: drive, but you could place it anywhere, and the batch files that it was calling were also in the C: drive, but could be anywhere by just modifying it like this...  CALL PATH\PROGRAM2.BAT etc. If you end up with long file names like "C:\Program Files\Long Folder Name\file.exe", the following should work: "c:\progra~1\longfo~1\file.exe" etc.

The other batch files contained things like this:
@echo off
start path\program

or, if "program" was already in the path...
@echo off
start program

I am sure that some more elegant and "high-tech" ways have been suggested, but the lowly batch file seemed to work OK when I tried it.

73 es cul - Keith VE7GDH
--
"I may be lost but I know exactly where I am"





More information about the aprssig mailing list