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

If you want to view a list of processes running on your computer and you are either unable to open Task Manager or you want to be able to print the list, we have a simple procedure that allows you to generate a list of running processes and write it to a text file. The list contains the PID (process ID) and memory usage for each process.

This procedure also works in Windows XP and Windows Vista.

To generate a list of running processes, open the Command Prompt as Administrator. To do this in Windows 7 or Windows Vista, enter “cmd” (without the quotes) in the Search Programs and Files box on the Start menu. The cmd.exe program should automatically be highlighted in the Programs section of the results. Press Ctrl + Shift + Enter to open cmd.exe as Administrator.

Starting cmd from the Search box in Windows 7

You can also open the Command Prompt as Administrator in Windows 7 or Windows Vista by opening All Programs | Accessories on the Start menu. Right-click on the Command Prompt shortcut and select Run as administrator from the popup menu.

Starting Command Prompt from Accessories

If you are using Windows XP, open All Programs | Accessories on the Start menu. Right-click on the Command Prompt shortcut and select Run as from the popup menu.

Selecting Run as for cmd in Windows XP

The Run As dialog box displays. Select the The following user radio button and select Administrator from the User name drop-down list, if it is not already selected. Enter the Administrator password in the Password edit box. Click OK.

Run As dialog box in Windows XP

If you are using Windows 7 and the User Account Control dialog box displays, click Yes to continue.

NOTE: You may not see this dialog box, depending on your User Account Control settings. See our post, Windows 7 – How to configure UAC (User Account Control), for more information.

User Account Control for cmd

To see the list of running processes directly in the Command Prompt window, enter the following line at the prompt and press Enter.

tasklist

A nice table with headings displays all the running processes.

Entering the tasklist command

To write the table of running processes to a text file, enter the following line at the prompt and press Enter.

tasklist > c:\processes_list.txt

NOTE: The above command saves a file called processes_list.txt to C:. If you want to save the file with a different name to a different location, enter the full path of the desired location and enter a different file name.

Writing the results of tasklist to a text file

In our example, the processes_list.txt file is written to the root of the C: drive.

processes_list.txt file created

The table of running processes is available in text file format, allowing you to print the information from a text editor, such as Notepad.

processes_list.txt file open in notepad

You can also generate a list of running services in the same manner. To do this, enter the following line at the prompt and press Enter.

tasklist/svc > c:\services_list.txt

NOTE: Again, you can change the path and filename as desired.

Generating a list of services

A table displays the list of services with their associated PIDs.

NOTE: This is a good way to find out what services are being hosted by the various instances of the svchost.exe file. Svchost.exe is a process that hosts other services to perform various functions and there can be multiple instances of svchost.exe running at one time. See our post, Svchost.exe explained and demystified, for more information about svchost.exe.

services_list.txt file

This procedure can come in handy if you need to kill a process and a virus is preventing Task Manager from opening. You can generate the list of running processes in the command prompt, get the PID for the process you want to kill, and then use the taskkill command to kill the process. Enter the following line on the command prompt for more information on how to use the taskkill command.

taskkill /?

Also, see our post, Quickly Kill Non-Responsive Programs in Windows 7 and Vista, for an easy way to kill non-responsive processes. The article was written about Windows 7 and Vista, but the taskkill command is also available in Windows XP.

by Lori Kaufman

Leave a Reply

Your email address will not be published. Required fields are marked *