List files
Files · Pattern / syntaxCMD
dir PowerShell
Get-ChildItem Alias (Windows): ls
Search code, tasks or categories in English or Spanish. Each entry has a link to save or share it.
Showing 42 of 42 commands
Windows: CMD and PowerShell. Replace <…> parameters before running. Aliases are shown separately and are not copied. These are comparable tasks; output can differ.
CMD
dir PowerShell
Get-ChildItem Alias (Windows): ls
CMD
dir /a PowerShell
Get-ChildItem -Force Includes hidden/system entries (dir /a, Get-ChildItem -Force); not a guarantee that access restrictions are bypassed.
DocumentationCMD
cd /d "<dir>" PowerShell
Set-Location -LiteralPath "<dir>" Alias (Windows): cd
CMD
cd PowerShell
Get-Location Alias (Windows): pwd
CMD
mkdir <dir> PowerShell
New-Item -ItemType Directory <dir> CMD
del <file> PowerShell
Remove-Item <file> Alias (Windows): rm
Changes or interrupts the selected target. Check the target and save work before running; elevated permissions may be required.
DocumentationCMD
rmdir /s /q <dir> PowerShell
Remove-Item -Recurse -Force <dir> Changes or interrupts the selected target. Check the target and save work before running; elevated permissions may be required.
DocumentationCMD
copy <src> <dst> PowerShell
Copy-Item <src> <dst> Alias (Windows): cp
CMD
xcopy <src> <dst> /s /e PowerShell
Copy-Item -Recurse <src> <dst> CMD
move <src> <dst> PowerShell
Move-Item <src> <dst> Alias (Windows): mv
CMD
type <file> PowerShell
Get-Content <file> Alias (Windows): cat
CMD
type nul > <file> PowerShell
New-Item -ItemType File -Path "<file>" CMD truncates an existing file. PowerShell New-Item -ItemType File fails if the file already exists unless -Force is used.
DocumentationCMD
findstr "text" <file> PowerShell
Select-String "text" <file> CMD
dir /s /b *name* PowerShell
Get-ChildItem -Recurse -Filter *name* CMD
cls PowerShell
Clear-Host Alias (Windows): cls
CMD
date /t && time /t PowerShell
Get-Date CMD
systeminfo PowerShell
Get-ComputerInfo CMD
hostname PowerShell
$env:COMPUTERNAME CMD
whoami PowerShell
[System.Security.Principal.WindowsIdentity]::GetCurrent().Name CMD
set PowerShell
Get-ChildItem Env: CMD
set "VAR=value" PowerShell
$env:VAR = "value" CMD
doskey /history PowerShell
Get-History CMD
shutdown /s /t 0 PowerShell
Stop-Computer Changes or interrupts the selected target. Check the target and save work before running; elevated permissions may be required.
DocumentationCMD
shutdown /r /t 0 PowerShell
Restart-Computer Changes or interrupts the selected target. Check the target and save work before running; elevated permissions may be required.
DocumentationCMD
ping <host> PowerShell
Test-Connection <host> CMD
ipconfig PowerShell
Get-NetIPAddress CMD
ipconfig /all PowerShell
Get-NetIPConfiguration CMD
ipconfig /flushdns PowerShell
Clear-DnsClientCache CMD
nslookup <host> PowerShell
Resolve-DnsName <host> CMD
netstat -an PowerShell
Get-NetTCPConnection Get-NetTCPConnection shows TCP only. Use Get-NetUDPEndpoint for UDP; these cmdlets require Windows.
DocumentationCMD
tracert <host> PowerShell
Test-Connection -Traceroute <host> Test-Connection -Traceroute requires PowerShell 6+; in Windows PowerShell 5.1 use tracert.exe.
DocumentationCMD
curl -O <url> PowerShell
Invoke-WebRequest <url> -OutFile <file> CMD
tasklist PowerShell
Get-Process CMD
taskkill /im <name> /f PowerShell
Stop-Process -Name <name> -Force CMD expects a name such as notepad.exe; Stop-Process -Name expects notepad, without .exe. Forced termination can lose unsaved work.
DocumentationCMD
taskkill /pid <pid> /f PowerShell
Stop-Process -Id <pid> -Force Changes or interrupts the selected target. Check the target and save work before running; elevated permissions may be required.
DocumentationCMD
start "" "<program>" PowerShell
Start-Process -FilePath "<program>" The empty first quoted argument is the CMD window title. Put the executable path in the second argument.
DocumentationCMD
sc query PowerShell
Get-Service CMD
net start <svc> PowerShell
Start-Service <svc> CMD
net stop <svc> PowerShell
Stop-Service <svc> Changes or interrupts the selected target. Check the target and save work before running; elevated permissions may be required.
DocumentationCMD
powershell -NoProfile -Command "Get-PSDrive -PSProvider FileSystem" PowerShell
Get-PSDrive -PSProvider FileSystem Calls Windows PowerShell from CMD; replaces WMIC, which is deprecated and may be unavailable.
DocumentationCMD
dir /s "<dir>" PowerShell
(Get-ChildItem -LiteralPath "<dir>" -File -Recurse -Force | Measure-Object -Property Length -Sum).Sum PowerShell sums file lengths in bytes, not allocated disk space. Hidden files are included; inaccessible files can produce an incomplete total.
DocumentationCMD
format <drive>: /fs:ntfs PowerShell
Format-Volume -DriveLetter <drive> -FileSystem NTFS Formatting destroys data on the selected volume. Use a drive letter without a colon for <drive> (CMD adds the colon). Check the volume first; administrator permissions are required.
DocumentationCompare Windows CMD and PowerShell commands for files, system information, networking, processes and disks. Copy each shell separately. Alias hints are excluded from the clipboard; replace parameters such as <file> and <dir> before running. Similar tasks can produce different output in each shell.
Use the shell indicated above each command. Quote paths containing spaces. CMD start treats its first quoted argument as a window title. PowerShell -Traceroute needs version 6 or later, and networking and volume cmdlets here are Windows-specific. Commands that remove files, stop processes or format volumes require checking the target and may need elevated permissions.
Free. No signup. Your inputs stay in your browser. Ads via Google AdSense (consent required).
By Marco B. ·