powershell - COPY-ITEM Passthru not working when encountering error -
within ise, i've tried both below. neither working. way clear $error
, test after copy attempt. suggestions?
$cpy = copy-item -path "d:\~a\2k0nvk0.xt" -destination "d:\~bkup-f\2k0nvk10.txt" -force -passthru -erroraction silentlycontinue if($cpy){ $cpy # displays on successful copy } try{ copy-item -path "d:\~a\2k0nvk0.xt" -destination "d:\~bkup-f\2k0nvk10.txt" -force -erroraction silentlycontinue } catch { write-host "hit bug!" # not being displayed }
a try/catch works when erroraction set stop.
Comments
Post a Comment