Greetings. I have a list of batchfiles that triggers Powershell script, that will throw error message when different errors were encountered in the execution.
In the end of the batchfile, I have included:
if%errorlevel% neq 0(echo errorin previous command &exit/b %errorlevel%)
and it works fine in itself.
However due to some requirements I need to use new separate batchfile that triggers a Powershell, that will in turn lauch the batchfiles mentioned earlier.
In the new Powershel, I have included:
$process = start-process $batchFile.FullName -ArgumentList $argumentList -PassThru -Wait
and is able to get $process.ExitCode. However I would like to get the output or error message that would be raised from the first batchfile instead.
Any advice?