NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Call Executable Step To Start EXE and Stop EXE

I would like to use the Call Executable step to Start an EXE (Executable) file which will run until I call another step to tell it to stop in my test sequence.  Basically, I want to be able to turn on the EXE and turn off the EXE when I want to inside the test sequence.  The EXE continuously pings a device.  Is there an efficient way to do this?  Thanks!

0 Kudos
Message 1 of 6
(5,324 Views)

testdesign,

 

Could you use LabVIEW VI's to run the executable on the Windows level then end its process?

 

Here are the instruction for using this process:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P821SAC

http://digital.ni.com/public.nsf/allkb/80432B061C5A4C888625705400737BE8

 

VanCamp

0 Kudos
Message 2 of 6
(5,283 Views)

I don't see a reason to use LabVIEW for this. The call executable step will let you specify a wait condition and store a handle to the spawned process:

Capture.PNG

You can either use the Process Handle to terminate the executable through the Windows API, or you could call taskkill from another call executable step to kill the process by name. Note: neither one of these options will end the process "cleanly"(if it has a handle open to an instrument, that handle will probably not be closed properly). To close an executable cleanly, you'd need to expose an exit function from within that application, or do something similar to what's described here.

 

-Trent

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 3 of 6
(5,262 Views)

Can someone please be more specific on how to "You can either use the Process Handle to terminate the executable through the Windows API"?

0 Kudos
Message 4 of 6
(4,753 Views)

Hey,

 

Refer to this documentation or this one (for a more python focused one) for more clarification on how to use the Windows API to terminate a process using the process handle. 

 

Thanks,

Roxy

0 Kudos
Message 5 of 6
(4,749 Views)

Thanks!

I will keep in in mind as I found a solution for using Python Steps without Call Executable and thus the process automatically runs and gets killed when needed.

0 Kudos
Message 6 of 6
(4,742 Views)