powershell - Copying a item without waiting -
i want copy package on network, of several gb , cant copying completed continue executing ps script , remaining tasks, not dependent. best way this?
currently think best way call script execute copy no wait. thoughts appreciated.
powershell has lot of options that. 1 simplest approach use copy psjob like:
#put script here want 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 remaining script here
or can
$copyjob = start-job –scriptblock { $source = "\\path\to\source\file" $target = "path\to\destination\file" copy-item -path $source -destination $target -recurse verbose }
you can use background intelligent transfer service (bits) cmdlets need have module present, should
import-module bitstransfer
Comments
Post a Comment