LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec and .bat files

I searched for this problem but I can't seem to find the exact solution. I have 4 batch files that I can double-click and they work fine. However, when I try to run these .bat files in LV with the System Exec VI I get "blahblablah file not found" errors. How can I duplicate double-clicking on a .bat file in LV?

PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 1 of 7
(3,699 Views)

Hi PaulG,

how do you call your bat files? Normally it should work with the System Exec vi.

 

Mike

Message 2 of 7
(3,697 Views)
Figured out part of my own problem, but now I have another related one. Now when the bat file completes the window stays open and I have to manually close it. This is not the same behavior as double-clicking the .bat file itself. With a double click I just press any key and the window closes. I guess what I want is a method in LV that exactly duplicates double-clicking a .bat file.
PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 3 of 7
(3,693 Views)

Hi PaulG,

maybe you get the same behavior as a double click if you use the "ShellExecute" function from the shell32.dll.

 

Hope it helps.

Mike

Message 4 of 7
(3,689 Views)
I've done very little with Call Library Function Node. I was hoping for something a little simpler.
PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 5 of 7
(3,650 Views)

Hi PaulG,

see the attached vi please. For me it works as expected.

 

Mike

Message 6 of 7
(3,633 Views)

Hi PaulG.,

 

I have found this article (KnowledgeBase 18T91CVJ:  After Running a Batch File with the System Exec VI, the Command Window Rema...), which offers a couple of options for forcing the .bat file to close.  I would try adding the "exit" command to your batch file.

Message 7 of 7
(3,607 Views)