Use this when chaining cmd output into filters.
Pipes
Pipes (|) send one command's output into another's input in cmd, such as ipconfig /all | findstr IPv4 or netstat -ano | find "443", to filter or chain results.
1. Test each command alone.
2. cmd1 | cmd2 — only stdout is piped.
3. Include errors: 2>&1 |.
4. Filter with findstr.
5. Check ERRORLEVEL of the last command.
cmd1 stdout → pipe → cmd2 stdin → output
Context & applicabilityCommon mistakes · platform/version boundaries
- Expecting
findstrto match PowerShell objects (convert withOut-String -Streamor useWhere-Object). - Piping large outputs through
morein scripts (waits for input). - Losing exit codes in pipelines (
%ERRORLEVEL%reflects the last command).
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Pipes pass text, not objects.
- Use findstr to filter lines.
- Errors (stream 2) are not piped unless redirected with 2>&1.
echo %PATH%— PATH in CMDset— environment variableswhere <name>— command resolutionecho %ERRORLEVEL%— exit code
ReferenceWhy it matters1 section · depth on demand
Examples
ipconfig /all | findstr /i "IPv4 DNS"
netstat -ano | findstr :443
tasklist | findstr /i chrome
type log.txt | find /c "ERROR"
Documented example, not captured output. cmd pipes pass text; PowerShell pipes pass objects (Get-Process | Where CPU -gt 100).
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Pipes in cmd pass text output of one program to the input of the next:
netstat -ano | findstr :443
tasklist /svc | findstr /i spooler
ipconfig /all | find "DNS Servers"
type big.log | more
wmic process get name,processid | sort
findstr supports simple regex (/r) and case-insensitivity (/i). Unlike PowerShell, cmd pipes are plain text — parse carefully or switch to PowerShell for anything structured.
cmd vs PowerShell pipes
In cmd, the pipe passes text from one program to the next (netstat -ano | findstr :443). In PowerShell it passes objects (Get-Process | Where-Object CPU -gt 100 | Sort-Object CPU). Native executables in PowerShell still output text, so use Select-String instead of findstr for consistency.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Command Prompt → Pipes. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands · confidence 94%