From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running a batch file with error output

Hello all

I have a situation where i have to run a .bat file to run an external program. As soon as the external program is run, it needs a trigger signal to be executed. Now , i need to get error outputs from System Exec. VI. ( because when an error comes in the external prgm, i need to see it )

 

I used a System Exec.vi to run .bat file with wait until completion = True. But then, the trigger VI is not executed.

with wait until completion = False, the .bat file is executed but then i dont get any error outputs.

 

is there any other way to run the batch file and to get standard outputs?

 

 

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 4
(2,279 Views)

Hi Nghtcwrlr,

 

What you described below sounds like expected behavior of an environment.To achieve the logic you are expecting you would need to add some extra functionality in between that would store error like simple logging to file.

 

Would this work for you?

Best Regards,
TK
Certified LabVIEW Architect (CLA)

0 Kudos
Message 2 of 4
(2,212 Views)

perhaps you can have something like a last line "SUCCESS" or "FAIL" that your .bat produces and then you can parse the output for this line


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 3 of 4
(2,208 Views)

Hi jwscs,

Thanks for the tip. i added a " >>Output.txt" line in the .bat file and the outcome ( Error AND/OR SUCCESS) of the bat file is saved in to this txt file. After that i check the last line of the txt file and proceed further.

 

 

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 4
(2,168 Views)