1. Home
  2. Docs
  3. Tutorials
  4. Navigating Windows using cmd or PowerShell

Navigating Windows using cmd or PowerShell

Print

You can use  commands on the command prompt or PowerShell to perform various tasks such as navigating the file system, managing files and directories and executing commands. This is a useful skill that is beneficial when using Linux and sometimes in IT. Here are some essential commands for navigating Windows OS on command Prompt or PowerShell:

  1. cd:
    1. Change the current directory or move to the specified directory
    2. Usage:
      • cd C:\path\to\directory
      • cd ..   # Move up one directory ie: parent directory
  2. dir
    1. List the contents of a directory
    2. Usage:
      • dir
      • dir /a #list all files and folders including hidden files
  3. md
    1. Creates a new directory
    2. Usage
      • md dirname
  4. copy
    1. Copy files or directories
    2. Usage:
      • copy source destination
      • Where source is the file or directory and destination is where the file or directory is pasted on
  5. move
    1. Move or rename files or directory
    2. Usage:
      • move source destination
      • move oldname newname   # Rename file
  6. del
    1. Used to delete files
    2. Usage:
      • del filename
  7. ren 
    1. Used to rename files or directories
    2. Usage:
      • ren oldname newname
  8. type
    1. Displays the content of text files
    2. Usage:
      • type filename.txt
  9. cls
    1. Used to clear the screen in Command prompt
    2. Usage:
      • cls

The following commands are PowerShell specific Commands:

  1. Get-ChildItem
    1. List the contents of a directory
    2. Usage:
      • Get-ChildItem
  1. New-Item
    1. Creates a new item which can be a file, directory, etc..
    2. Usage:
      • New-Item -ItemType Directory dirname
      • New-Item filename.txt -ItemType File
  2. Copy-Item
    1. Used to copy a file or directory
    2. Usage:
      • Copy-Item source destination
      • source being the item being copied and destination being where the item is copied to 
  3. Move-Item
    1. Used to move or rename files or directories
    2. Usage:
      • Move-Item source destination
      • Move-Item oldname newname
  4. Remove-Item
    1. Used to delete files or directories
    2. Usage:
      • Remove-Item filename
      • Remove-Item dirname -Recurse   
  5. Rename-Item
    1. Used to rename files or directories
    2. Usage:
      • Rename-Item oldname newname
  6. Get-Content
    1. Displays the contents of a file
    2. Usage:
      • Get-Content filename
  1. Set-Location 
    1. Used to change the current working directory
    2. Usage:
      • Set-Location C:\path\to\directory
  2. Clear-Host
    1. Used to clear the screen in PowerShell
    2. Usage:
      • Clear-Host

How can we help?