PowerShell错误:无法移动项目,因为xxx处的项目正在使用中
我正在使用PowerShell,在执行某些操作后,我需要将项目移动到文件夹中删除所有空文件夹 当我运行以下脚本时,我得到一个错误:PowerShell错误:无法移动项目,因为xxx处的项目正在使用中,powershell,window,Powershell,Window,我正在使用PowerShell,在执行某些操作后,我需要将项目移动到文件夹中删除所有空文件夹 当我运行以下脚本时,我得到一个错误: Move-Item : Cannot move item because the item at 'C:\Projects\xxx\aaa' is in use. At line:58 char:1 + Move-Item $dist $fin + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidO
Move-Item : Cannot move item because the item at 'C:\Projects\xxx\aaa' is in use.
At line:58 char:1
+ Move-Item $dist $fin
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Move-Item], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.MoveItemCommand
你知道怎么解决这个问题吗
# delete all empty folder recursively at any levels
do {
$dirs = gci $tdc -directory -recurse | Where { (gci $_.fullName).count -eq 0 } | select -expandproperty FullName
$dirs | Foreach-Object { Remove-Item $_ }
} while ($dirs.count -gt 0)
# move folder
Move-Item $dist $fin
Write-Host '- Moving files executed.'
请尝试使用Process Explorer查看该文件的用途/folder您的工作目录是您要移动的目录吗?不,它不在同一目录中