dirGet-ChildItem (ls)dir /aGet-ChildItem -Forcecd <dir>Set-Location <dir> (cd)cdGet-Location (pwd)mkdir <dir>New-Item -ItemType Directory <dir>del <file>Remove-Item <file> (rm)rmdir /s /q <dir>Remove-Item -Recurse -Force <dir>copy <src> <dst>Copy-Item <src> <dst> (cp)xcopy <src> <dst> /s /eCopy-Item -Recurse <src> <dst>move <src> <dst>Move-Item <src> <dst> (mv)type <file>Get-Content <file> (cat)type nul > <file>New-Item <file>findstr "text" <file>Select-String "text" <file>dir /s /b *name*Get-ChildItem -Recurse -Filter *name*clsClear-Host (cls)date /t && time /tGet-DatesysteminfoGet-ComputerInfohostname$env:COMPUTERNAMEwhoami$env:USERNAMEsetGet-ChildItem Env:set VAR=value$env:VAR = "value"doskey /historyGet-Historyshutdown /s /t 0Stop-Computershutdown /r /t 0Restart-Computerping <host>Test-Connection <host>ipconfigGet-NetIPAddressipconfig /allGet-NetIPConfigurationipconfig /flushdnsClear-DnsClientCachenslookup <host>Resolve-DnsName <host>netstat -anGet-NetTCPConnectiontracert <host>Test-Connection -Traceroute <host>curl -O <url>Invoke-WebRequest <url> -OutFile <file>tasklistGet-Processtaskkill /im <name> /fStop-Process -Name <name> -Forcetaskkill /pid <pid> /fStop-Process -Id <pid> -Forcestart <program>Start-Process <program>sc queryGet-Servicenet start <svc>Start-Service <svc>net stop <svc>Stop-Service <svc>wmic logicaldisk get size,freespace,captionGet-PSDrive -PSProvider FileSystemdir /s <dir>(Get-ChildItem -Recurse | Measure-Object Length -Sum).Sumformat <drive>: /fs:ntfsFormat-Volume -DriveLetter <drive>CMD vs PowerShell Cheatsheet
Windows has carried two shells for years: the old Command Prompt, which traces its lineage back to MS-DOS conventions from the early eighties, and PowerShell, introduced in 2006 to bring object-aware piping and a .NET-style scripting model to the platform. Both still ship in modern Windows, and every working sysadmin alternates between them depending on what's installed, what's scripted, and what's pasted from Stack Overflow. The cheatsheet below puts 40+ everyday tasks side by side — files, system info, network, processes, disk — so the right syntax for whichever shell happens to be open is one search away. Most trouble juggling the two shells does not come from forgetting commands. It comes from quirks that look harmless until they bite. `set VAR=value` in CMD silently includes any trailing space in the value, which is why the quoted form `set "VAR=value"` is the safer habit. `for /f` parses with `tokens=` and `delims=`, and getting either wrong skips fields without any error. PowerShell, meanwhile, stops on terminating errors only — a `Remove-Item` on a missing file is non-terminating by default and the script carries on. These are the snippets that get pulled up while debugging exactly that: the matching command on the other shell, the flag that quotes properly, the redirection that actually writes, without trawling through `/?` help text from the first line each time.
Common pitfalls in CMD and PowerShell
A few habits earn their place when scripting across both Windows shells. In CMD, quote whole assignments — `set "PATH=%PATH%;C:\bin"` — because trailing whitespace before the closing `&` or newline becomes part of the value otherwise. Variable expansion is `%var%` at parse time and `!var!` after `setlocal enabledelayedexpansion` inside loops, and mixing the two is the source of most empty-string bugs in `for` blocks. In PowerShell, `$ErrorActionPreference = 'Stop'` flips the default non-terminating model so a single `Remove-Item` failure halts the script instead of being logged and ignored. Piping in PowerShell moves objects, not text, so `Get-Process | Where-Object CPU -gt 100` filters on the property directly — no `findstr` needed. Path separators differ in subtle ways too: CMD accepts forward slashes for some built-ins but not all, while PowerShell normalises them through `Join-Path`. PowerShell's `ExecutionPolicy` blocks unsigned scripts by default on workstations, and the most common quick-fix `Set-ExecutionPolicy -Scope Process Bypass` runs only for the current session, which is the safer trade-off when running a one-off downloaded script. Comments also diverge: CMD uses `REM` or `::`, while PowerShell uses `#` for single-line and `<# ... #>` for blocks — pasting a script from one into the other without changing the comment markers is a familiar paper cut. Knowing both shells is less about preference and more about practical compatibility. Legacy batch files written decades ago still ship inside vendor installers and inside pipelines that nobody is going to rewrite, and PowerShell is where every modern Windows automation story now lives, from Active Directory administration to Azure resource provisioning. Most working sysadmins keep one foot in each, switching by what the situation demands rather than by ideology, and a reference that maps the equivalents directly avoids the small but constant cost of context-switching between two mental models that nominally do the same thing but in completely different ways. The cheatsheet groups everything into Files, System, Network, Processes, and Disk so the equivalent on either shell is one click away.
- 40+ task equivalents between CMD and PowerShell
- Side-by-side comparison layout
- Filter by category (Files, System, Network, Processes, Disk)
- Full-text search across tasks and commands
- Copy CMD or PowerShell command independently
Free. No signup. Your inputs stay in your browser. Ads via Google AdSense (consent required).