How to recursively delete an entire directory with PowerShell 2.0?

前端 未结 18 2133
南旧
南旧 2020-12-07 07:26

What is the simplest way to forcefully delete a directory and all its subdirectories in PowerShell? I am using PowerShell V2 in Windows 7.

I have learned from severa

18条回答
  •  长情又很酷
    2020-12-07 07:46

    Try this example. If the directory does not exist, no error is raised. You may need PowerShell v3.0.

    remove-item -path "c:\Test Temp\Test Folder" -Force -Recurse -ErrorAction SilentlyContinue
    

提交回复
热议问题