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.