Example Code

Search-List Running Application on Computer (tasklist)

Code and Documents

Attachment

Overview

These examples provide a list of running processes running on the host machine. The goal is to list and search if a specific application is running.

Description

This example was developped to see if an .exe was already running or not. There are two approaches to do this.

  1. Based on this example, the VI (List Running Application_v1.vi) extracts a task list from System.Exec.vi and builds an array of strings from all running application. Next, the array can be manipulated in LV to search for a specific process.
  2. Based on this example, the VI (Search Running Application.vi) has a filter on the command line input of the System.Exec.vi to directly search for the application. This VI is simpler for searching for a single process and does not need an array with all running application.

Additional notes:

  • Some applications are represented with capital letters, so the VIs search with both type of characters.
  • The List Running Application_v1.vi requires the OpenG toolkit library which is available for download here- VIPM
  • Information regarding the "cmd.exe" command lines and filters about tasklist is available here
  • These examples were tested with Windows 7 and some cmd.exe commands may not behave properly with Windows XP

Steps to Implement or Execute Code

  1. Download either of the examples
  2. Run the VI and confirm the services are running

Requirements

Software

LabVIEW 2011 or later

OpenG toolkit library

Windows 7

VI Snippet

Example 1:

List Running Applications.png

Example 2:

Search Running Application.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Ofinodeyev
Member
Member
on

Good stuff. But I will allow myself to do some comments: please do not include into your examples something outside of standard LabVIEW functions. Best wishes.

PDG
Member
Member
on

Thanks this had the information I was looking for.

Contributors