End Windows Processes Using LabVIEW

Updated Apr 27, 2018

Reported In

Software

  • LabVIEW

Issue Details

How can I end a process with LabVIEW like I do from task manager in Windows?

Solution

The System Exec.vi function in LabVIEW allows a VI to make calls to the Windows Command Prompt.  From the Window Command Prompt, it is possible to end a process (task) using the taskkill command. 
If you wanted to close Notepad, for example, you could use the following command:

taskkill /f /im notepad.exe

The VI snippet below takes the task name as a string input on the front panel and appends that to the end of the taskkill command, then sends that to the command prompt using System Exec.vi, which will cause the named process to end. Task names must be entered as they appear in the task manager
(e.g. calc.exe, excel.exe, explorer.exe).
 


 

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Additional Information

You can also find the VI posted on the NI Community, linked below.

WAS THIS ARTICLE HELPFUL?

Not Helpful