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: 

How can I determine if Shell is running?

Solved!
Go to solution

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?

Veni Vidi Duci
0 Kudos
Message 1 of 7
(3,464 Views)

Did you use the system execute vi to run the batch file? If so there is a boolean node for wait until completion?.



-Matt
0 Kudos
Message 2 of 7
(3,447 Views)

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.



-Matt
0 Kudos
Message 3 of 7
(3,430 Views)

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.

 

Veni Vidi Duci
0 Kudos
Message 4 of 7
(3,406 Views)

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.

 

0 Kudos
Message 5 of 7
(3,374 Views)
Solution
Accepted by topic author DB_IQ

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.

Veni Vidi Duci
0 Kudos
Message 6 of 7
(3,329 Views)

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.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 7
(3,322 Views)