|
#1
|
|||
|
|||
Make sure that the batch file is exiting with a non-zero exit code when the PowerShell script fails, and use the Batch File action in Visual Build to call it, or include the call statement (i.e., %DOSCMD% call batchfile.bat) when running the batch file if calling directly (otherwise the exit code may not be returned to Visual Build).
http://www.microsoft.com/resources/d....mspx?mfr=true https://stackoverflow.com/questions/...ering-an-error https://stackoverflow.com/questions/...ograms#4825773 http://www.kinook.com/Forum/showthread.php?t=260 |
#2
|
|||
|
|||
Thank you, would try out the remedy suggested. Much appreciated.
|
#3
|
|||
|
|||
Hi again, I have tried to add throw error in PowerShell, and batch file exits with error code greater than 0. However when I call the batch file through VBP, it will stuck at Building... process. Note that the batch file to be called is located in remote machine.
|
#4
|
|||
|
|||
It works in our tests. See the attached sample and log.
|
#5
|
|||
|
|||
I ran the same batch file and vbp from the attachment, but placing them in a different machine from where the VBP resides, and it is stucked at executing the step.
I have use the batch file command script "%DOSCMD% call psbatch.bat" or "cmd /c 'echo . | psbatch.bat'". I am using this approach as I need to pass various parameters back to batch file. |
#6
|
|||
|
|||
It works on a different remote machine in our tests.
|
#7
|
|||
|
|||
Could it be due to firewall setting? Remotely running the batch file works, but the exit code seems not able to catch, hence it stucks in execution state.
However when I tried to remotely execute the psbatch with command "powershell -command" the VBP is able to show the error and shows program completed with exit code. But when adding "throw" into the batch file it will stuck in execution. |
Tags |
error , halt , powershell , vbp |
Thread Tools | |
Display Modes | Rate This Thread |
|
|