PowerShell vs. CMD: Command Comparison

This guide provides a structured comparison between CMD (Command Prompt) commands and their PowerShell equivalents. CMD has been a core command-line utility for Windows users for decades, while PowerShell is a more advanced shell designed for automation and system management.

File & Directory Management

Task: Show Current Directory

  • CMD Command: cd
  • PowerShell: Get-Location

Task: List Files and Folders

  • CMD Command: dir
  • PowerShell: Get-ChildItem

Task: Change Directory

  • CMD Command: cd foldername
  • PowerShell: Set-Location foldername

Task: Go Up One Level

  • CMD Command: cd ..
  • PowerShell: Set-Location ..

Task: Create a New Directory

  • CMD Command: mkdir foldername
  • PowerShell: New-Item -ItemType Directory -Path foldername

Task: Create a File

  • CMD Command: echo. > file.txt
  • PowerShell: New-Item -ItemType File -Path file.txt

Task: Copy a File

  • CMD Command: copy file.txt D:\Backup\
  • PowerShell: Copy-Item file.txt -Destination D:\Backup\

Task: Move a File

  • CMD Command: move file.txt D:\NewFolder\
  • PowerShell: Move-Item file.txt -Destination D:\NewFolder\

Task: Delete a File

  • CMD Command: del file.txt
  • PowerShell: Remove-Item file.txt

Task: Delete a Directory

  • CMD Command: rmdir foldername /S /Q
  • PowerShell: Remove-Item foldername -Recurse -Force

Task: Rename a File

  • CMD Command: ren oldname.txt newname.txt
  • PowerShell: Rename-Item oldname.txt -NewName newname.txt

Task: View File Contents

  • CMD Command: type file.txt
  • PowerShell: Get-Content file.txt

Task: Clear Screen

  • CMD Command: cls
  • PowerShell: Clear-Host

Network Commands

Task: View Wireless NIC Info

  • CMD Command: netsh wlan show interfaces
  • PowerShell: Get-NetAdapter -Name 'Wi-Fi'

Task: Check Network Configuration

  • CMD Command: ipconfig /all
  • PowerShell: Get-NetIPConfiguration

Task: Flush DNS Cache

  • CMD Command: ipconfig /flushdns
  • PowerShell: Clear-DnsClientCache

Task: Ping a Website

  • CMD Command: ping google.com
  • PowerShell: Test-Connection google.com

Task: Trace Network Route

  • CMD Command: tracert google.com
  • PowerShell: Test-NetConnection google.com -TraceRoute
Previous
Previous

Command Prompt | System & Network Commands

Next
Next

Windows PowerShell | Scripts for Tech Support