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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -