Powershell Command: rm -rf Powershell Command: rm -rf powershell powershell

Powershell Command: rm -rf


PowerShell isn't UNIX. rm -rf is UNIX shell code, not PowerShell scripting.

  • This is the documentation for rm (short for Remove-Item) on PowerShell.
  • This is the documentation for rm on UNIX.

See the difference?

On UNIX, rm -rf alone is invalid. You told it what to do via rm for remove with the attributes r for recursive and f for force, but you didn't tell it what that action should be done on. rm -rf /path/to/delete/ means rm (remove) with attributes r (recursive) and f (force) on the directory /path/to/remove/ and its sub-directories.

The correct, equivalent command on PowerShell would be:

rm C:\path\to\delete -r -fo

Note that -f in PowerShell is ambiguous for -Filter and -Force and thus -fo needs to be used.


You have to use:

Remove-Item C:\tmp -Recurse -Force

or (short)

rm C:\tmp -Recurse -Force