powershell Remove-Item code example

Example 1: powershell remove folder and contents

Remove-Item -LiteralPath "foldertodelete" -Force -Recurse

Example 2: how to delete a file using powershell

Remove-Item "path/filename.extension"

Example 3: powershell delete folder

Remove-Item 'D:\temp\Test Folder1'

Example 4: remove item powershell

Remove-Item
      [-Path] <String[]>
      [-Filter <String>]
      [-Include <String[]>]
      [-Exclude <String[]>]
      [-Recurse]
      [-Force]
      [-Credential <PSCredential>]
      [-WhatIf]
      [-Confirm]
      [-Stream <String[]>]
      [<CommonParameters>]

Tags:

Misc Example