VOOZH about

URL: https://www.geeksforgeeks.org/cpp/how-to-get-the-list-of-all-running-tasks-in-cpp/

⇱ How to Get the List of All Running Tasks in C++? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Get the List of All Running Tasks in C++?

Last Updated : 23 Jul, 2025

In C++, we have the one that may need the running tasks list for different purposes. In OS, we can get that list from the terminal using the tasklist system call. In this article, we will learn how to get the list of all the running processes using C++.

Run Tasklist in C++

C++ provides the system() function that is used to make the system calls. We can run the tasklist command using this system() function in C++. Running the tasklist command allows you to retrieve a list of the currently running processes on a Windows system and display it to the user.

The system function allows us to execute a command in the operating system's shell. We'll use the "tasklist" command to retrieve the list of the running processes.

Syntax

system("tasklist");

The function returns zero if the command is executed successfully. It will print the task list on the console.

C++ Program to Get the List of All Running Tasks


Output

Running tasklist command to retrieve list of running processes
System 4 Services 0 140 K
Registry 136 Services 0 57,756 K
smss.exe 584 Services 0 948 K
csrss.exe 916 Services 0 5,456 K
wininit.exe 508 Services 0 6,372 K
...........

Note: This command will only run on Windows Operating System.

Comment
Article Tags: