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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -