The Problem with the Task Manager
In Windows 11, if you want to monitor your computer’s CPU usage, memory consumption, or disk I/O, the standard approach is to open the Task Manager (Ctrl+Shift+Esc) or the Resource Monitor. While these graphical tools are excellent for quick visual checks, they are useless for long-term data logging or automated scripts. You cannot easily extract the raw numbers from the Task Manager window and pipe them into an Excel spreadsheet for analysis.
If you are a system administrator who needs to log exactly how much RAM a specific application consumes overnight, you need a command-line solution.
The typeperf command is a built-in Windows utility that hooks directly into the Windows Performance Monitor engine. It allows you to query thousands of specific hardware and software metrics and stream the raw data directly into the command window or a CSV file.
Step 1: Finding Available Performance Counters
The Windows Performance engine tracks thousands of “counters”. A counter is simply a specific metric, such as “Available Megabytes of RAM” or “CPU Percentage”. Before you can log data, you need to know the exact internal name of the counter you want to track.
Open the Command Prompt (no administrator privileges required for basic counters) and run:
typeperf -q
This will dump a massive, overwhelming list of every single counter available on your PC. To make this manageable, pipe the output into the find command to filter for what you actually want.
For example, to find counters related to your processor, run:
typeperf -q | find "Processor"
You will see a counter named \Processor(_Total)\% Processor Time. This is the master counter for total CPU utilization.
Step 2: Streaming Data to the Command Window
Once you know the name of the counter, you can tell typeperf to start reading it. By default, the command will read the metric once per second and print the result as a raw number to the screen forever, until you press Ctrl+C to stop it.
typeperf "\Processor(_Total)\% Processor Time"
The terminal will output something like this:
"(PDH-CSV 4.0)","\\YOUR-PC\Processor(_Total)\% Processor Time"
"08/22/2026 14:30:00.000","12.456789"
"08/22/2026 14:30:01.000","15.123456"
"08/22/2026 14:30:02.000","09.987654"
Step 3: Exporting Data to a CSV File
Streaming numbers to a terminal window is fun to watch, but it isn’t useful for long-term analysis. The true power of typeperf is its ability to natively format and export this data directly into a Comma-Separated Values (CSV) file, which can be instantly opened in Microsoft Excel.
Use the -o (output) flag to specify a file path:
typeperf "\Memory\Available MBytes" -o %USERPROFILE%\Desktop\MemoryLog.csv
Step 4: Controlling the Logging Interval and Duration
If you leave the command above running all night, it will record a data point every single second, resulting in a massive CSV file with over 30,000 rows.
You can use the -si (sample interval) flag to tell the command to only read the data every X seconds. You can also use the -sc (sample count) flag to tell the command to stop automatically after it collects a specific number of samples.
For example, if you want to log your CPU usage exactly once every 60 seconds, and you want it to stop automatically after exactly 60 samples (which equals exactly 1 hour of monitoring), run:
typeperf "\Processor(_Total)\% Processor Time" -si 60 -sc 60 -o %USERPROFILE%\Desktop\CPU_Hour_Log.csv
The command will sit silently in the background. After exactly one hour, it will terminate itself, leaving a perfectly formatted 60-row CSV file on your desktop ready for graphing.