• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

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!!
0
k_hoffhines
Asked:
k_hoffhines
  • 3
1 Solution
 
Ron MalmsteadInformation Services ManagerCommented:
Wscripts.sleep(30000)
0
 
Ron MalmsteadInformation Services ManagerCommented:
...sorry..not wscripts

Wscript.sleep(30000)
0
 
Ron MalmsteadInformation Services ManagerCommented:
vb script..


wscript.sleep(30000)
set WshShell = WScript.CreateObject("WScript.Shell")
wshShell.run "c:\yourprogram.exe"
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now