How to Get the List of All Running Tasks in C++? Last Updated : 28 Apr, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Syntaxsystem("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 C++ // C++ program to illustrate how to get the list of all the // running programs #include <cstdlib> #include <iostream> using namespace std; int main() { // Print the objective of program cout << "Running tasklist command to retrieve " "list of running processes:" << endl; // Execute the tasklist command and display the output int returnValue = system("tasklist"); if (returnValue != 0) { cerr << "Error executing tasklist command" << endl; return 1; } return 0; } 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 More infoAdvertise with us Next Article How to Measure Elapsed Time in C++? S subramanyasmgm Follow Improve Article Tags : C++ system-programming Practice Tags : CPP Similar Reads How to Measure Elapsed Time in C++? Measuring elapsed time is a common requirement for most software development packages. It is used to determine the efficiency of the program and gives an idea of which parts of the program takes which much time. This helps in optimizing the code, such that improves its execution time. In this articl 3 min read To-Do List in C++ A to-do list is generally used list all the task that a person wants or needs to do and then track his progress on it. This is a simple yet effective way to get the work done. In this article, we will learn how to create a console based C++ program to implement to do list. This application will allo 6 min read Packaged Task | Advanced C++ (Multithreading & Multiprocessing) The  std::packaged_task class wraps any Callable objects (function, lambda expression, bind expression, or another function object) so that they can be invoked asynchronously. A packaged_task won't start on its own, you have to invoke it, As its return value is stored in a shared state that can be c 3 min read C++ 20 - <stop_token> Header C++20 has introduced the <stop_token> Header, presenting an alternative method for canceling asynchronous operations. A new class std::stop_token is provided by the <stop_token> header that allows for seamless communication of a termination request between two threads. In this article, w 4 min read C++ 23 <stacktrace> - Header Imagine you're on an adventure, exploring a vast and dense forest. Along the way, you encounter challenges that might leave you feeling lost or confused. In such situations, a map or compass would be invaluable tools to guide you back on track. Similarly, in the world of programming, stack traces se 5 min read Create Processes with Fork in C++ fork() is a system call that creates a child process from the parent process. Whenever we call fork() from the parent program, a child process is created that has the exact copy of the address space. The important thing to remember is it shares the copy of the address space, not the copy itself. Syn 3 min read Like