带有排除的Move-Item不起作用

时间:2017-04-23 20:40:27

标签: powershell

我有两个脚本应该做同样但第一个不起作用,第二个不起作用。这是为什么?我已经设法弄清楚它与Execlude有关。它说:

Move-Item : Cannot move item because the item at 'E:\hudba\test.ps1' does not exist. At line:1 char:1 + Move-Item "E:\test\*" "E:\ ... + CategoryInfo     : InvalidOperation: (:) [Move-Item], PSInvalidOperationException   + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.MoveItemCommand

脚本

Move-Item "E:\test\*" "E:\test2" -Exclude "*.ps1"

Get-ChildItem -Path "E:\test\*" -Recurse -Exclude "*.ps1" | Move-Item -Destination "E:\test2"

谢谢:)

1 个答案:

答案 0 :(得分:1)

这是一个已知问题,定于v6修复

https://github.com/PowerShell/PowerShell/issues/2385