powershellcopy-item

Want to wait till copy complete using Powershell Copy-Item


I am copying files from One Windows machine to another using Copy-Item in Powershell script.

But I want to wait till copy completes, Powershell Copy-Item is non-blocking call means, it just triggers copy and returns to script however I want to wait till copy completes.

Is there any way to do it ?


Solution

  • Copy-Item does block. I just copied a 4.2GB file from a share on our gigabit network to my local machine. My PowerShell prompt hung and didn't return for several minutes.