Hi,
I would like to get the @error value from when you run a command that does not exist, as in the below code:
;intentionaly pass in an exe that is misspelled
$CmdStatus = RunWait(@ComSpec & " /c " & "foo")
$AtError = @error
msgbox(48, "ERROR", "CmdStatus =" & $CmdStatus, 20)
msgbox(48, "ERROR", "errorocde =" & $AtError, 20)
If ($AtError <>0) Then
$ScriptletExitCode = $AtError
$ScriptletExitMessageStr = "Error running 'foo'."
Return $ScriptletExitCode
EndIf
If ($CmdStatus <> 0) Then
$ScriptletExitCode = $CmdStatus
$ScriptletExitMessageStr = "Error from 'foo'."
Return $ScriptletExitCode
EndIf
$ScriptletExitCode = $CmdStatus
In all cases I have tried @error=0, any help will be greatly appreciated.
Ideally I would like to capture the case where the command cannot be launched with the @error value, and then use the return code from the command to catch errors the program reports.
Thanks!!!