ZetCode

Windows Command Prompt Process Management

last modified July 14, 2025

Process management in Windows Command Prompt involves viewing, controlling, and terminating running processes. A process is an instance of an executing program that consumes system resources. Effective process management helps monitor system performance and troubleshoot issues.

The Command Prompt provides several tools for process management including tasklist, taskkill, and wmic. These commands allow administrators to view running processes, check resource usage, and terminate unresponsive programs. Process management is essential for system maintenance and troubleshooting.

Each process has a unique Process ID (PID) that identifies it in the system. Processes can be foreground (interactive with user) or background (running silently). Understanding process hierarchy helps manage dependent processes and services effectively.

This tutorial covers fundamental process management commands and techniques. We'll explore viewing processes, filtering results, checking resource usage, and terminating processes. These skills are valuable for system administrators and power users alike.

Viewing Running Processes

The tasklist command displays all currently running processes on the system. This is the primary command for process monitoring in Command Prompt.

view_processes.bat
@echo off
echo Listing all running processes:
tasklist

This simple script demonstrates the basic tasklist command. It shows all running processes with their PIDs, memory usage, and other details.

tasklist

Displays all running processes in a tabular format. The output includes image name, PID, session name, session number, and memory usage.

C:\>view_processes.bat
Listing all running processes:

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0          8 K
System                           4 Services                   0        132 K
smss.exe                       456 Services                   0      1,048 K
csrss.exe                      564 Console                    1      4,212 K
wininit.exe                    652 Services                   0      4,320 K
...

The output shows system and user processes. The exact list varies based on running applications and services.

Filtering Process List

Tasklist supports filtering to find specific processes. Filters help locate processes by name, memory usage, or other criteria.

filter_processes.bat
@echo off
echo Processes using more than 100MB memory:
tasklist /fi "memusage gt 100000"

echo Chrome processes:
tasklist /fi "imagename eq chrome.exe"

This script shows two filtering examples: by memory usage and by process name. Filters use comparison operators like gt (greater than) and eq (equals).

tasklist /fi "memusage gt 100000"

Lists processes using more than 100MB memory. The /fi parameter specifies the filter condition. Memory values are in kilobytes.

tasklist /fi "imagename eq chrome.exe"

Shows all running Chrome browser processes. This helps identify multiple Chrome instances and their resource usage.

C:\>filter_processes.bat
Processes using more than 100MB memory:

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
chrome.exe                   1234 Console                    1    123,456 K
mysqld.exe                   5678 Services                   0    234,567 K

Chrome processes:

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
chrome.exe                   1234 Console                    1    123,456 K
chrome.exe                   2345 Console                    1     98,765 K

Output shows filtered results based on the specified conditions. Actual values depend on current system state.

Terminating Processes

The taskkill command terminates running processes by PID or name. This is useful for stopping unresponsive applications.

kill_process.bat
@echo off
echo Terminating notepad.exe if running:
taskkill /im notepad.exe /f

echo Terminating process by PID:
taskkill /pid 1234 /f

This script demonstrates two ways to terminate processes: by image name and by PID. The /f flag forces termination.

taskkill /im notepad.exe /f

Terminates all instances of notepad.exe. The /im parameter specifies the image name (process name). /f forces termination.

taskkill /pid 1234 /f

Terminates a specific process by its PID. Replace 1234 with an actual PID from tasklist. Useful for targeting specific instances.

C:\>kill_process.bat
Terminating notepad.exe if running:
SUCCESS: The process "notepad.exe" with PID 5678 has been terminated.

Terminating process by PID:
SUCCESS: The process with PID 1234 has been terminated.

Output confirms successful termination. Errors occur if the process doesn't exist or lacks permissions.

Detailed Process Information

WMIC provides detailed process information beyond tasklist. It shows complete process details including command line and parent PID.

process_details.bat
@echo off
echo Detailed process information:
wmic process where name="chrome.exe" get processid,commandline,parentprocessid

echo Process memory details:
wmic process where name="chrome.exe" get workingsetsize,virtualsize

This script uses WMIC to query detailed Chrome process information. WMIC provides extensive process properties not available in tasklist.

wmic process where name="chrome.exe" get processid,commandline,parentprocessid

Retrieves Chrome processes with their PIDs, command lines, and parent PIDs. Helpful for identifying specific process instances.

wmic process where name="chrome.exe" get workingsetsize,virtualsize

Shows memory usage details for Chrome processes. Workingsetsize is physical memory usage, virtualsize is virtual memory allocation.

C:\>process_details.bat
Detailed process information:
CommandLine              ParentProcessId  ProcessId  
chrome.exe --type=renderer           1234       5678  
chrome.exe --type=gpu-process        1234       6789  

Process memory details:
VirtualSize  WorkingsetSize  
123456789    23456789  
987654321    34567890  

Output shows detailed process information. The command line reveals how each process was launched and its specific function.

Starting Processes

The start command launches new processes from Command Prompt. It provides control over window state and priority.

start_process.bat
@echo off
echo Starting Notepad minimized:
start /min notepad.exe

echo Starting calculator with normal priority:
start /normal calc.exe

This script demonstrates starting applications with different window states and priority levels. The start command offers several configuration options.

start /min notepad.exe

Launches Notepad in a minimized window. Useful for background processes that don't need immediate user interaction.

start /normal calc.exe

Starts Calculator with normal priority. Other priority options include /low, /high, and /realtime (use with caution).

C:\>start_process.bat
Starting Notepad minimized:
Starting calculator with normal priority:

The commands execute silently if successful. The applications launch according to the specified parameters.

Source

Windows Command Reference

In this article, we have covered process management in Windows Command Prompt. These commands enable effective monitoring and control of system processes.

Author

My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming.