2017-09-12 1 views
1

네트워크를 통해 패키지를 복사하려고합니다.이 패키지는 몇 GB 크기로되어있어 내 PS 스크립트 및 나머지 작업을 종속성에 따라 계속 실행하기 위해 복사를 완료 할 수 없습니다. 이 작업을 수행하는 가장 좋은 방법은 무엇입니까?기다리지 않고 항목 복사

현재 최선의 방법은 기다리지 않고 사본을 실행하기 위해 다른 스크립트를 호출하는 것입니다. 당신의 생각은 많이 감사합니다.

답변

3

Powershell에는이를 수행 할 수있는 많은 옵션이 있습니다. 한 가지 간단한 방법은 같은 사본로 PSJob을 사용하는 것입니다 :

#Put you script here which you want to do before copying 
$source_path = "\\path\to\source\file" 
$destination_path = "path\to\destination\file" 
Start-Job -ScriptBlock {param($source_path,$destination_path) Copy-item $source_path $destination_path} -ArgumentList $source_path,$destination_path 

# Keep Your remaining script here 

또는이

$copyJob = Start-Job –ScriptBlock { 
    $source = "\\path\to\source\file" 
    $target = "path\to\destination\file" 
    Copy-Item -Path $source -Destination $target -Recurse Verbose 
} 
당신은 BITS (Background Intelligent Transfer Service)를 cmdlet을 사용할 수 있습니다

만에 같이 할 수 모듈을 가져와야한다고 가정합니다.

Import-Module BitsTransfer 
관련 문제