ltjKt1 Posted June 22, 2010 Posted June 22, 2010 Hi,I am trying to figure out how to catch errors thrown by Ghost32.exe. In CMD ghost32 will return and set the ERRORLEVEL variable to 0 if successful.My script has this:Func Ghost($pImagePath, $pDestination, $pPathToGhostFiles ) RunWait($pPathToGhostFiles & "ghost32.exe -clone,mode=prestore,src=" & $pImagePath & ":1,dst=" & $pDestination & " -sure") EndFuncIn a batch file, I would do something like this:IF ERRORLEVEL 1 (ECHO --- !!!There was a Problem and Ghost did not finish imaging!!! COLOR 4f) ELSE (ECHO --- Ghosting Complete COLOR 2F)Can anyone help?? I found one related post, but couldn't make any sense of it.Thanks,Josh
JFX Posted June 22, 2010 Posted June 22, 2010 RunWait retruns the %errorlevel% Func Ghost($pImagePath, $pDestination, $pPathToGhostFiles ) $ErrorLevel = RunWait($pPathToGhostFiles & "ghost32.exe -clone,mode=prestore,src=" & $pImagePath & ":1,dst=" & $pDestination & " -sure") ;Msgbox(0,"Ghost Errolevel", "Error: " & $Errorlevel) Return $Errorlevel EndFunc
ltjKt1 Posted June 22, 2010 Author Posted June 22, 2010 RunWait retruns the %errorlevel% Func Ghost($pImagePath, $pDestination, $pPathToGhostFiles ) $ErrorLevel = RunWait($pPathToGhostFiles & "ghost32.exe -clone,mode=prestore,src=" & $pImagePath & ":1,dst=" & $pDestination & " -sure") ;Msgbox(0,"Ghost Errolevel", "Error: " & $Errorlevel) Return $Errorlevel EndFunc Thanks! I am so stupid!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now