We help IT Professionals succeed at work.
Get Started

Status "Open" for Reg.exe Load when launched using the WshShell Exec Method

jknuce asked
Last Modified: 2012-08-13
I am loading a Win PE registry hive using a VBscript and the WshShell exec method. I am using the status property as a indicator to proceed. However, the status returned is always 0, even after the registry hive is loaded. Am I doing something wrong?
Option Explicit
Call ExecCmd("%comspec% /k reg.exe load HKLM\WIM_SOFTWARE ""C:\PE2-Image\mount\windows\system32\config\software""")

Sub ExecCmd(cmd)
  Dim objShell,objExec
  Set objShell = CreateObject("WScript.Shell")
  Set objExec = objShell.Exec(cmd)
	Do While objExec.Status = 0
		Wscript.echo "Process Still Open = " & objExec.Status
		wscript.Sleep 100
		Wscript.echo "Process Closed = " & objExec.Status
End Sub

Open in new window

Watch Question
Tech Lead (Windows), Endpoint Device Management Services
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE