T
Ty Moffett
I'm using a queue to hold a series of strings that are complete command line
arguments to start the silent/unattended installation of various pieces of
software. Here is some sample code.
1 Dim myProcess as New Process
2 myProcess.EnableRaiseEvents = True
3 myProcess.StartInfo.Filename = myQ.Dequeue ' The string value in this
instance is "c:\windowsXP-KB824146-x86-ENU.exe /u /n /z"
4 Do Until (myProcess.HasExited = True)
5 Loop
6 AutoLogon() ' Sets various registry keys.
7 RunOnce() ' Sets some more registry keys.
8 Shell("shutdown.exe -r -f -t 05") ' Forces a reboot of the system in 5
seconds.
The problem is that on line 4 it throws an exception "No Process is
associated with this object".
The other problem is that if I take out the do loop entirely the .exe fires
off and begins installation but the program doesn't wait for it to finish.
It immediately move on to 6, 7, and worst of all 8. Then the system reboots
mid-installation.
Is there a good way to make the thing wait until the installation is done
before continuing on? I piddled with Process.ExitCode as well with no luck.
Thanks in advance. =)
arguments to start the silent/unattended installation of various pieces of
software. Here is some sample code.
1 Dim myProcess as New Process
2 myProcess.EnableRaiseEvents = True
3 myProcess.StartInfo.Filename = myQ.Dequeue ' The string value in this
instance is "c:\windowsXP-KB824146-x86-ENU.exe /u /n /z"
4 Do Until (myProcess.HasExited = True)
5 Loop
6 AutoLogon() ' Sets various registry keys.
7 RunOnce() ' Sets some more registry keys.
8 Shell("shutdown.exe -r -f -t 05") ' Forces a reboot of the system in 5
seconds.
The problem is that on line 4 it throws an exception "No Process is
associated with this object".
The other problem is that if I take out the do loop entirely the .exe fires
off and begins installation but the program doesn't wait for it to finish.
It immediately move on to 6, 7, and worst of all 8. Then the system reboots
mid-installation.
Is there a good way to make the thing wait until the installation is done
before continuing on? I piddled with Process.ExitCode as well with no luck.
Thanks in advance. =)