How to recursively delete an entire directory with PowerShell 2.0?

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

    Remove-Item -Recurse -Force some_dir
    

    does indeed work as advertised here.

    rm -r -fo some_dir
    

    are shorthand aliases that work too.

    As far as I understood it, the -Recurse parameter just doesn't work correctly when you try deleting a filtered set of files recursively. For killing a single dir and everything below it seems to work fine.

提交回复
热议问题