SSH Command in Windows with examples

Files and folders commands in Windows

Move around, create, copy, rename and delete files and folders in Command Prompt (CMD) and PowerShell.

#cd / Set-Location

Change folder

Syntaxcd [path]
  • cd C:\Users\Alice\DocumentsCMD

    Go to a folder

  • cd ..CMD

    Go up one level

  • cd /d D:\ProjectsCMD

    Switch to another drive and folder at once (CMD needs /d)

  • Set-Location C:\WindowsPowerShell

    PowerShell's full name; cd also works

TipType a drive letter and a colon, such as D:, to switch drives in CMD.

#dir / Get-ChildItem

List files and folders

Syntaxdir [path] [options]
  • dirCMD

    List the current folder

  • dir /aCMD

    Include hidden files

  • dir /s *.txtCMD

    Search every sub-folder for .txt files

  • dir /o-dCMD

    Newest first

  • Get-ChildItem -ForcePowerShell

    List everything including hidden items (alias: ls, gci)

  • Get-ChildItem -Recurse -Filter *.logPowerShell

    Find all .log files below here

#pwd / Get-Location

Show the current folder

Syntaxcd | Get-Location
  • cdCMD

    In CMD, typing cd alone prints the current folder

  • Get-LocationPowerShell

    Print the current folder (alias: pwd)

#mkdir / New-Item

Create a folder

Syntaxmkdir name
  • mkdir ReportsCMD

    Create a folder

  • mkdir Reports\2026\OctoberCMD

    CMD creates the whole chain automatically

  • New-Item -ItemType Directory -Path ReportsPowerShell

    Create a folder in PowerShell

#rmdir / Remove-Item

Delete a folder

Syntaxrmdir [/s] [/q] name
  • rmdir EmptyFolderCMD

    Remove an empty folder

  • rmdir /s /q OldBuildCMD

    Remove a folder and everything in it without asking

  • Remove-Item -Recurse -Force OldBuildPowerShell

    The PowerShell way

CarefulDeleted files do not go to the Recycle Bin when you use these commands. Check the path carefully.

#copy / xcopy / robocopy

Copy files

Syntaxcopy source destination
  • copy report.docx D:\Backup\CMD

    Copy a file

  • xcopy Photos D:\Backup\Photos /E /ICMD

    Copy a folder with sub-folders

  • robocopy C:\Data D:\Backup /MIRCMD

    Make D:\Backup an exact mirror of C:\Data (deletes extra files!)

  • robocopy C:\Data D:\Backup /E /R:2 /W:5CMD

    Copy everything, retry twice, wait five seconds

  • Copy-Item -Recurse C:\Data D:\BackupPowerShell

    PowerShell copy

Tiprobocopy is the best choice for big copies: it resumes and can retry on errors.

#move / ren

Move or rename

Syntaxmove source destination | ren old new
  • move report.docx D:\Archive\CMD

    Move a file

  • ren notes.txt notes-old.txtCMD

    Rename a file

  • Move-Item old.txt D:\Archive\PowerShell

    PowerShell move

  • Rename-Item old.txt new.txtPowerShell

    PowerShell rename

#del / erase

Delete files

Syntaxdel [options] file
  • del temp.txtCMD

    Delete a file

  • del /q *.tmpCMD

    Delete without asking

  • del /f /q readonly.txtCMD

    Force-delete a read-only file

  • Remove-Item *.tmpPowerShell

    PowerShell delete

#type / Get-Content

Show a file

Syntaxtype file
  • type notes.txtCMD

    Print the file

  • more notes.txtCMD

    Print one page at a time (Space for next page)

  • Get-Content app.log -Tail 50PowerShell

    Last 50 lines

  • Get-Content app.log -WaitPowerShell

    Keep watching new lines (Ctrl+C to stop)

Create a link

Syntaxmklink [/D] link target
  • mklink /D C:\site D:\web\siteCMD

    Folder symbolic link (needs an administrator window)

#tree

Show folders as a tree

Syntaxtree [path] [/F]
  • tree /FCMD

    Show folders and files

#attrib

File attributes

Syntaxattrib [+r|-r|+h|-h] file
  • attrib +h secret.txtCMD

    Hide a file

  • attrib -r file.txtCMD

    Remove the read-only flag

#notepad / code

Open an editor

Syntaxnotepad file
  • notepad notes.txtCMD

    Open Notepad

  • code .CMD

    Open the current folder in VS Code (if installed)

Run these commands with SSH Command

SSH Command is a desktop app for Mac, Windows and Linux that puts a real terminal, SFTP file panes, a sudo switch and a searchable Linux command finder in one window. Type what you want to do, and send the command to your server with one click.

Download free Linux commands with examples SFTP & FTP client