How to recursively delete an entire directory with PowerShell 2.0?

前端 未结 18 2098
南旧
南旧 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:59

    To delete the complete contents including the folder structure use

    get-childitem $dest -recurse | foreach ($_) {remove-item $_.fullname -recurse}
    

    The -recurse added to remove-item ensures interactive prompts are disabled.

提交回复
热议问题