Advertisement
Guest User

Untitled

a guest
Jul 19th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ErrorActionPreference = "Stop"
  2. trap {
  3.     Write-Error "$($Error[0] | Out-String)"
  4.     echo hi
  5.     Read-Host "Press enter"
  6. }
  7. Split-Path -BAD
  8. echo "Running script"
  9. Read-Host -Prompt "Press Enter to exit"
  10. Split-Path : A parameter cannot be found that matches parameter name 'BAD'.
  11. At line:8 char:16
  12. + Split-Path -BAD <<<<
  13.     + CategoryInfo          : InvalidArgument: (:) [Split-Path], ParameterBindingException
  14.     + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SplitPathCommand
  15.  
  16.  
  17.     + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
  18.     + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
  19.  
  20.  
  21.  
  22.  
  23. $ErrorActionPreference = "Stop"
  24. trap {
  25.     Write-Error $Error[0]
  26.     echo hi
  27.     Read-Host "Press enter"
  28. }
  29. Split-Path -BAD
  30. echo "Running script"
  31. Read-Host -Prompt "Press Enter to exit"
  32. A parameter cannot be found that matches parameter name 'BAD'.
  33.     + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
  34.     + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement