04-01-2010 09:15 AM
Hi,
I have an executable file I compiled in Labview and I run it from the command line (CMD) as a part of a command sequence.
The command line may look like this for example:
Command#1
Command#2
MyLabviewFile.exe
Command#3
Command#4
....
Once the exe file starts it runs for about 1 minute.
The problem is that the command line is not locked while the executable is runing and the following command (#3 in the example) is sent before the executable finishes. This can cause a problem.
I must "freeze"/lock the prompt sign while the executable is runing or have some kind of indication INSIDE THE COMMAND LINE when the executable finishes. Or any other way to make command#3 starts only when the executable finishes.
Does anybody have an idea how to do this ?
Solved! Go to Solution.
04-02-2010 04:05 PM
Hello,
Certainly a good question fro implementation in LabVIEW. For Command Line interaction LabVIEW employs the System Executive.vi, which allows users to programmatically run command line scripts from the LabVIEW application. However, this function creates new instances of the command window each time.
I am currently experimenting with a custom Batch file , that may implement variable logic to wait for process completion. I will post additional in formation, or an example batch file, when it is completed.
Cheers!
Patrick Corcoran
Application Engineering Specialist | Control
National Instruments
04-03-2010 12:28 AM - edited 04-03-2010 12:29 AM
Instead of using
MyLabVIEWFile.exe
use
cmd /C MyLabVIEWFile.exe
This will cause the command sequence to hang until MyLabVIEWFile.exe finishes executing. If your exe/path has spaces in it, you will need to put quotes around it like such:
cmd /C "MyLabVIEWFile.exe"
04-03-2010 02:18 AM
04-06-2010 12:54 AM
Hi all,
Sorry for the late reply, I've out of office for a few days.
The following command isn't waiting for any input from the executable.
However, Matthew suggestion seems to do the job.
One I type
cmd /C "MyLabVIEWFile.exe" the commander waits until the executable finishes.
Cheers!
Thanks,
Mentos.