I am creating a program that will install multiple programs, because I build new computer quite often. For example "MyInstallProgram" will launch and allow the user to select which programs (MSOffice, Acrobat, WinZip etc.) to install.

When compiling the program, what code can I use that will insert a time delay so that I do not have 5 install programs running and installing all at once.

Is there code that would insert 30 seconds before the next line of code is executed? What would that code look like?


Logic:

If MSOffice checked then,
open c:\windows\msofficesetup.exe

wait 30 seconds

If Acrobat checked then,
open c:\acrobatsetup.exe

wait 30 seconds...

etc.

Dani AI

Generated

A fixed sleep (for example the 30 second pause in the original post) is brittle: it can still let installs overlap, and it freezes the thread that called it. pointed this out with a sleep-based idea, and was right to point toward waiting for the process instead. For reliable sequential installs, start each installer and wait for that process to exit (or use its Exit event), then move to the next. That avoids arbitrary delays and gives you an actual completion signal. ’s note about Ninite is useful for common consumer apps, but for custom or commercial installers you will usually need the process-control approach below.

Example — start and wait (do this off the UI thread so the UI stays responsive):

' Run an installer and wait (run this loop on a background thread)
Dim psi As New ProcessStartInfo()
psi.FileName = "C:\installers\msofficesetup.exe"
psi.Arguments = "/quiet"   ' installer-specific; check vendor docs
psi.UseShellExecute = True ' required if you set Verb = "runas"
psi.Verb = "runas"         ' prompt for elevation if needed

Dim p As Process = Process.Start(psi)
If p IsNot Nothing Then
    ' wait up to 10 minutes (600000 ms) to avoid indefinite hang
    If p.WaitForExit(600000) Then
        Dim rc As Integer = p.ExitCode
        ' inspect rc and log success/failure
    Else
        ' timed out - consider killing or logging for manual review
        Try
            p.Kill()
        Catch ex As Exception
            ' log error
        End Try
    End If
End If

Non-blocking alternative — use the Exited event to chain installers without blocking the caller thread:

Dim p As New Process()
p.StartInfo.FileName = "C:\installers\acrobatsetup.exe"
p.StartInfo.Arguments = "/S"
p.EnableRaisingEvents = True
AddHandler p.Exited, Sub(s, e)
                        ' start next installer here (marshal to UI thread if updating UI)
                    End Sub
p.Start()

Practical tips: run installers elevated or create the installer process with elevation (UAC will prompt); prefer calling msiexec directly for MSI packages; know each installer's silent/quiet switches; always capture exit codes and logs; use sensible timeouts to avoid hangs. For large-scale or repeatable lab builds, consider deployment tools instead of per-machine scripting.

Recommended Answers

All 5 Replies

Somthing like.

System.Threading.Thread.Sleep(1000) ' Sleep for 1 second

?

check out this site for how to delay until the process has ended to continue with the next one.

What site? I think you forgot to post the link ;).

Sorry about that.

Hope this helps,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.