08-01-2016 04:21 PM
I issued a command to Windows Shell to execute a batch file.
Once the command is executed, LabVIEW keeps going.
I would like to be able to tell if the Windows Shell is running, so I can wait accordingly for it to finish.
Is there a way to do this?
Solved! Go to Solution.
08-01-2016 05:36 PM
Did you use the system execute vi to run the batch file? If so there is a boolean node for wait until completion?.
08-01-2016 06:01 PM
Also, you can use the system execute vi to launch your batch file. I have done this before. The command is
cmd / c start "your batch file path""your batch file path"
path was required twice in the command.
hope that helps.
08-02-2016 09:27 AM - edited 08-02-2016 09:28 AM
Well, the problem is the batch file I am trying to run has to be executed as an administrator. Which made the system cmd unfeasible.
I had a seperate thread on the original issue:
http://forums.ni.com/t5/LabVIEW/How-to-Run-System-Exec-Batch-File-as-an-Admin/m-p/3327937#M975931
I had to use Shell to get the program to launch properlly. Now what I need to do is know when it finishes, and preferably what the result was.
08-03-2016 04:40 PM
If the operation is going to take a predictable amount of time you could always put a delay in your code before you continue execution. This would be the simplest approach if your application is predictable enough.
08-09-2016 09:26 AM - edited 08-09-2016 09:27 AM
I identified a work around:
I modified my batch file to simply write to a text file the results, as well as to write when the process is finished.
It's far from Ideal, but it works for what I need it to do.
Thanks anyway for the assistance.
08-09-2016 10:38 AM
You can also use the .NET process library to find the handle of the process and then detect when it has finished executing - it's a useful library and offers a lot more functionality than System Exec.