Jump to content

Using sleep instead of /wait


GaF

Recommended Posts


Hi

I've the same problem with some installers. You start with a setup.exe and after a short wile you get the command prompt back again and the installer is still running (This because the installer have created another process and ended the original). My solution is more general.

Create a script that monitors a installer process. Then create a batch script like this.

Example from when installing MSDN

@setup.exe

@Cscript wait.vbs 001msdn.exe

--wait.vbs---

Option Explicit

'On Error Resume Next

Dim bCheck, quitCode, colItems, objItem, objWMIService, strComputer, sArg1

strComputer = "."

If WScript.Arguments.Count > 0 Then

sArg1 = WScript.Arguments(0)

Else

WScript.Echo "Enter <program.exe> as parameter"

WScript.Quit 1

End If

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

WScript.Sleep 5000

quitCode = 2 'No program.exe found

Do

bCheck = False

Set colItems = objWMIService.ExecQuery("Select * from Win32_Process Where Caption='" & LCase(sArg1) & "'",,48)

For Each objItem in colItems

quitCode = 0

bCheck = True

WScript.Sleep 1000

Exit For

Next

Loop While bCheck

WScript.Quit quitCode

----

Link to comment
Share on other sites

How do i use sleep.exe from RunOnce ?

you have two options for using sleep.exe in runonceex:

1) copy it to system32 and just call it sleep.exe XX in your cmd files

2) use it along with your setup files are and call it as above, but you have to have sleep.exe where every cmd file is.

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...