powershell - Getting error after using ErrorAction Silentlcontinue in my command -


i still getting error in out after using -erroraction silentcontinue. here command using:

 get-childitem c:\ -include *.bak -recurse | foreach ($_) {remove-item $_.fullname } -erroraction silentlycontinue -errorvariable 

you retrieve error within get-childitem cmdlet. should add parameter there (-ea 0 alias -erroraction silentlycontinue).

also usage of foreach-object cmdlet within code obsolete since remove-item cmdlet takes pipeline object:

get-childitem c:\ -include *.bak -recurse -ea 0 |  remove-item -ea 0 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -