End Windows Processes Using LabVIEW

Updated Feb 20, 2019

Reported In


  • LabVIEW

Issue Details

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

Another task is using a resource I need in LabVIEW, how can I resolve this conflict?


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.


Suspend Task 

A potential method for resolving a resource conflict between programs is to suspend the task, rather than ending it abruptly. This can be done through the PsTools provided by Microsoft. With this installed follow the example above, but use the command:
pssuspend insert_task_here.exe

The task can then be resumed at a later point with the command:

pssuspend -r insert_task_here.exe