List all process running windows

How to print the list of running processes in Windows

One of our readers asked us: “How do you print the list of running processes from the Task Manager?”. The answer is… you can’t do this from the Task Manager , not even in Windows 10. In order to print such a list, you need to use the Command Prompt or PowerShell and run some commands to generate the list of running process and then you can print it just like you would print a document. Let’s see how it all works:

NOTE: This guide works in Windows 10, Windows 8.1 and Windows 7.

How to print the list of running processes from the Command Prompt

Start the Command Prompt and use the following command: tasklist > “path to file”. The tasklist command displays a list of applications and services for all tasks running on your Windows computer. The parameter used specifies the text file where this list is saved. I wanted to save the list in a file named processes.txt , on my D drive, so I typed: tasklist > “D:processes.txt”. When choosing the path where you want to save the file, make sure it is a place where your user account has access.

If you need some help with opening the Command Prompt , read this guide: 7 Ways To Launch The Command Prompt In Windows.

When you open the output file in Notepad , you see it formatted as shown in the screenshot below. The data is placed in a table with the following columns: Image Name , PID (Process ID), Session Name , Session# (# stands for Number) and Mem Usage (Memory Usage).

Obviously, this command has parameters you can use to format its output. Complete documentation can be found on Microsoft’s TechNet website here: Tasklist. Don’t hesitate to read it and experiment on your own.

How to print the list of running processes from PowerShell

PowerShell is a more complex command-line tool that allows for more customization of its output. The basic command to use is: get-process or gps (its short version).

To send its output to a text file, you need to write get-process | out-file “path to file” or gps | out-file “path to file”. I wanted to save the list in a file named process.txt , on my D drive, so I typed: get-process | out-file “D:process.txt”. You can see this command as well as its short-version alternative, type in the PowerShell window below. When choosing the path to where you want to save the file, make sure that it is a place where your user account has access.

If you need help starting PowerShell , don’t hesitate to read this article: What is PowerShell & What can you do with it?.

The output text file is formatted as shown below and it includes the following columns:

  • Handles – The number of handles that the process has opened.
  • NPM(K) – The amount of non-paged memory that the process is using, in kilobytes.
  • PM(K) – The amount of pageable memory that the process is using, in kilobytes.
  • WS(K) – The size of the working set of the process, in kilobytes. The working set consists of the pages of memory that were recently referenced by the process.
  • CPU(s) – The amount of processor time that the process has used on all processors, in seconds.
  • Id – The process ID (PID) of the process that is running.
  • SI – unfortunately we couldn’t find any documentation for this column and the data it shares.
  • ProcessName – The name of the process that is running.
Читайте также:  Что будет если удалить windows messenger

As you can see, the output is more complex than when using the Command Prompt. Also, there are plenty more options to customize the output. I recommend that you read the following documentation: Get-Process (Get a list of processes running on a machine), Out-File (Send output to a file) and Out-Printer (Send output to a printer).

Conclusion

We hope that you found this tutorial useful. If you know other methods for printing a list of the processes that are running in Windows, don’t hesitate to share them using the comments form below.

get all running processes info using QProcess

few days ago i asked about how to get all running processes in the system using QProcess. i found a command line that can output all processes to a file:

C:\WINDOWS\system32\wbem\wmic.exe» /OUTPUT:C:\ProcessList.txt PROCESS get Caption

this will create C:\ProcessList.txt file contains all running processes in the system. i wonder how can i run it using QProcess and take its output to a variable.

it seems every time i try to run it and read nothing happens:

i prefer not to create process.txt at all and to take all the output to a variable.

2 Answers 2

You can run wmic.exe with «/OUTPUT:STDOUT» switch to print the process info directly to stdout. However, I was unable to read this info through QProcess API and save it in variable. Here’s the code I used:

This code successfully captures output of «cmd.exe /C echo test», but doesn’t work on wmic.exe. It seems that process wmic.exe is never finished, and I suppose it’s stdout is never flushed so you don’t receive anything throught QProcess::readAll().

That’s all help I can give you. Maybe you, or some other SO user will find bug in the snippet above.

Try this it will work well.

Not the answer you’re looking for? Browse other questions tagged windows qt qprocess or ask your own question.

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Get full running process list ( Visual C++ )

I am currently using the EnumProcesses function to obtain a list of running processes. Since my application runs in user space, however, it is not able to get handles for processes not running under the user, including System processes. Is there another method that will give me access to these? All I need are the process names.

4 Answers 4

I finally found a solution (figures after posting here as my last desperate attempt). If anyone else only needs a list of process names running on the system (all processes), this will do it for you.

Just to add to this answer, I built this for cases when you are looking for just one particular process instead of the entire list.

I should note here this was written in Embarcadero RAD Studio (C++ Builder) and per @Remy_Lebeau System::AnsiString is a C++Builder string class for 8bit ANSI character data in its VCL/FMX frameworks.

Читайте также:  Windows 10 remote desktop connection где найти

If all you need are just process names, then use WTSEnumerateProcesses as such:

The benefit of using this method is that you don’t have to open each process individually and then retrieve its name as what you’d have to do if you went with EnumProcesses instead, which also won’t work if you try to open processes that run with higher privileges than your user account.

Additionally this method is also much faster than calling Process32First() / Process32Next() in a loop.

WTSEnumerateProcesses is a lesser known API that has been available since Windows XP.

Save a List of Running Processes to a Text File in Windows

In case you want to print them out

Sometimes, it can seem like there are so many processes running on your computer that you’re unsure which are okay and which might be suspicious or malicious.

A good first step is generating a list of running processes to a text file so you can analyze what processes are running. Usually, people use Task Manager to view all processes, but it doesn’t let you print the list of processes.

Thankfully, saving a list of running processes to a text file in Windows is very simple. You’ll be able to save both the Process ID (PID) and how much memory each process is using.

Note: The steps below to save processes to file work for all versions of Windows including Windows XP, Windows 7, Windows 8, and Windows 10.

Output Processes From The Tasklist Command

The easiest way to get a quick list of processes that are running on your Windows system is using the tasklist command. To run the command properly, you need to run it from the command prompt as an administrator.

To do this, select the start menu and type “command”, then hover the mouse over Command Prompt so it’s highlighted and then select Run as administrator on the right.

Note: You may need to select Yes on a pop-up window to approve running Command Prompt as administrator.

Once the command prompt is open, type tasklist and press enter to see a list of processes running on your system.

This is useful, but it doesn’t provide you the list of running processes in a text file. To save processes to file, repeat the process above, but this time type the command:

tasklist > c:\process_list.txt

This will output a text file named process_list.txt to your C: drive. You can change C:\ to any other path where you’d like to place the file if you want.

To view the file, just open Windows Explorer and browse to the location where you saved the process list file.

To view this process list in Notepad, right-click the file, select Open with, and select Notepad.

This is the quickest and easiest way to see running processes in Windows via a text file. It’ll show you PID, Session name, Session number, and memory usage.

Save Processes To File Using Powershell

Another tool you have available to save a list of running processes to a text file in Windows is Powershell.

Powershell includes a command called “get-process” that provides a list of all active processes that are running on your local computer. To see this in action, launch Powershell by selecting the Start menu and typing Powershell.

Once the blue Powershell window opens, type get-process and press Enter. This will display a list of all active processes on your Windows system.

This provides a little more information about processes than tasklist does. However, you need to know what the headers mean.

  • Handles: Number of handles that the process has opened
  • NPM(K): Non-paged memory the process is using (in kilobytes)
  • PM(K): Pageable memory the process is using (in kilobytes)
  • WS(K): Pages in memory recently used by the process (in kilobytes)
  • VM(M): Virtual memory used by the process (in megabytes)
  • CPU(s): Processor time used by the process across all processors (in seconds)
  • ID: Process ID of the process
  • ProcessName: Name of the process
Читайте также:  Для чего нужна панель инструментов windows

This is great, but all of this information is displayed on the screen and not to a file. To output this information to a file, you need to add the Out-File parameter to the Get-Process command.

Back in the Powershell screen, type the command Get-Process | Out-File -FilePath .\Process_list.txt and press Enter.

The .\Process_list.txt parameter puts the file in the path where you run the command, so make note of that path so you know where to find the process list file. After you’ve run the command, use the same process as above to open the process list file in Notepad.

You’ll notice that the data in the file looks identical to the Get-Process output in the previous Powershell window.

Save Processes To File Using WMIC

The last tool you have at your disposal in Windows is the Windows Command Line Utility (WMIC).

You can only use WMIC commands if you are running the command prompt as a local administrator. To do this, use the steps in the first section of this article to launch the Windows command prompt as an administrator.

WMIC provides you with more information about active processes than any other command or tool in Windows. If you just run the WMIC Process command in the command prompt, you’ll see up to 44 process parameters returned for every active process.

The problem with running the command in the command prompt is that the space delimited output looks jumbled and disorganized.

The WMIC command is a perfect example of when an output file is useful. You can output the WMIC process list to a file using the command: wmic /OUTPUT:C:\ProcessList.txt PROCESS get /all.

This will output the entire list to a text file on the C: drive called ProcessList.txt. Instead of opening this file in Notepad, you’ll want to open it using Excel since Excel can properly format a tab delimited file.

  1. Open Excel
  2. Select Open to open a new file
  3. Select Browse and browse to the ProcessList.txt file
  4. Select the file and select Open (if you don’t see the file, change file type to All Files)
  5. In the Text Import Window, select Delimited, select My data has headers, and select Next to continue

  1. In the next wizard screen, select the Space checkbox under the Delimiters section and select the Treat consecutive delimiters as one checkbox. Select Next to continue.

  1. Select Finish to complete the wizard.

Now you’ll see just about anything you could possibly want to know about every active process on your Windows system.

The header of each column describes what that data item is. You’ll find things like executable path, handle, install date, page faults, page file usage, process ID, and much more.

Now that you know multiple ways to save a list of running processes to a text file in Windows, all you have left to do is choose the one that’s right for you!

Do you know of any other ways to save processes to file? Share your thoughts in the comments section below.

Ryan has been writing how-to and other technology-based articles online since 2007. He has a BSc degree in Electrical Engineering and he’s worked 13 years in automation engineering, 5 years in IT, and now is an Apps Engineer. Read Ryan’s Full Bio

Оцените статью