gpt4 book ai didi

Powershell删除除一个文件夹外的所有文件夹

转载 作者:行者123 更新时间:2023-12-03 00:31:43 28 4
gpt4 key购买 nike

我试过了

Get-ChildItem -Path  'C:\temp' -Recurse Select Name | Where {$_ -notlike 'C:\temp\one*'} | sort length -Descending | Remove-Item -force 

但是没用

Get-ChildItem : A positional parameter cannot be found that accepts argument 'Name'

怎么了

最佳答案

你错过了一个|

Get-ChildItem -Path  'C:\temp' -Recurse | Select -ExpandProperty FullName | Where {$_ -notlike 'C:\temp\one*'} | Remove-Item -force 

关于Powershell删除除一个文件夹外的所有文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63606946/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com