Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PowerShell错误:无法移动项目,因为xxx处的项目正在使用中_Powershell_Window - Fatal编程技术网

PowerShell错误:无法移动项目,因为xxx处的项目正在使用中

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

我正在使用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          : 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您的工作目录是您要移动的目录吗?不,它不在同一目录中