powershell - 带排除的移动项目不起作用

标签 powershell

我有两个脚本应该执行相同的操作,但第一个脚本不起作用,第二个脚本起作用。这是为什么?我设法弄清楚它与排除有关。它说:

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"

谢谢:)

最佳答案

这是一个已知问题,预计 v6 会修复

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

关于powershell - 带排除的移动项目不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43576281/

相关文章:

powershell - PowerShell 是否以不同于普通变量的方式对待环境变量?

xml - 如何使用 Powershell 编辑 XML?

PowerShell 函数参数 : Can the first one be optional first?

android - 从 Oracle 程序运行 Powershell 命令

powershell - 有没有办法用 Sonar 分析 powershell 脚本?

powershell - 纠缠:无法访问父作用域变量

powershell - 更改对象中列的顺序

arrays - 在Powershell中,如何通过 “value”而不是 “reference”将对象存储在数组中?

sql - 我如何在 azure for DTU 上自动运行此脚本

string - 文字替换-字符串和空格