powershell - 想要使用 Powershell Copy-Item 等到复制完成

标签 powershell copy-item

我正在使用 Powershell 脚本中的 Copy-Item 将文件从一台 Windows 机器复制到另一台机器。

但是我想等到复制完成,Powershell Copy-Item 是非阻塞调用方式,它只是触发复制并返回到脚本但是我想等到复制完成。

有什么办法吗?

最佳答案

Copy-Item 确实会阻塞。 我刚刚从我们的千兆网络上的共享复制了一个 4.2GB 的文件到我的本地机器。我的 PowerShell 提示挂起,几分钟后没有返回。

关于powershell - 想要使用 Powershell Copy-Item 等到复制完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12211131/

相关文章:

powershell - 将 PowerShell 变量作为 cmdlet 参数传递

powershell - 使用Invoke-Command时“You cannot call a method on a null-valued expression”

powershell - 如何直接通过管道传输到 Copy-Item 而不是在 ForEach-Object 中

Powershell 脚本在 "Copy-Item"命令处失败

powershell - 从 PSSession 内的 New-PSDrive 复制项目

powershell - Powershell:无法访问MSMQ Cmdlet

powershell - 正确编辑变量值

powershell - 从PowerShell启动非父进程

windows - 使用不同凭据在windows机器之间复制文件的解决方案

powershell - PowerShell为测试路径 “False”返回 “C$\Program Files (x86)”