Delay Start Script for application.exe

I would like to create a startup script for a couple workstation, to auto start an application but have it a delayed start for 30 seconds or be able to change for custom fit per server. The applications rely on a few services that take a while to start. I would like some kind of a script any help would be appreciated!!
k_hoffhinesAsked:
Who is Participating?
 
Ron MalmsteadConnect With a Mentor Information Services ManagerCommented:
vb script..


wscript.sleep(30000)
set WshShell = WScript.CreateObject("WScript.Shell")
wshShell.run "c:\yourprogram.exe"
0
 
Ron MalmsteadInformation Services ManagerCommented:
Wscripts.sleep(30000)
0
 
Ron MalmsteadInformation Services ManagerCommented:
...sorry..not wscripts

Wscript.sleep(30000)
0
 
oBdACommented:
Here's a batch script that will check a configurable list of services and only start the application (in the background) once all services are up and running.
A log file is created in the the temp folder (when running as startup script usually in %Systemroot%\temp, when started as user for testing in %Temp%).
Note that a startup script has a default timeout of 10 minutes, after which it will be kicked out, done or not, but that should be enough in your case.
@echo off
setlocal
set DependList="Java Quick Starter" "Alerter"
set LogFile=%Temp%\%~n0.log
>"%LogFile%" echo %Date% %Time% Waiting for services: %DependList%
:Loop
set AllStarted=1
for %%a in (%DependList%) do (
  net.exe start | find /i "%%~a"
  if errorlevel 1 (
    >>"%LogFile%" echo %Date% %Time% Not started yet: %%a
    set AllStarted=0
  ) else (
    >>"%LogFile%" echo %Date% %Time% Running: %%a
  )
)
if %AllStarted%==0 (
  sleep.exe 5
  goto Loop
)
>>"%LogFile%" echo %Date% %Time% All services running, starting application
start "" "T:\he\application.exe"
>>"%LogFile%" echo %Date% %Time% Done.

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.