ltjKt1 0 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 Share this post Link to post Share on other sites
JFX 10 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 Share this post Link to post Share on other sites
ltjKt1 0 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! Share this post Link to post Share on other sites