Windows PowerShell Scripting and Toolmaking by Jones Don

Windows PowerShell Scripting and Toolmaking by Jones Don

Author:Jones, Don [Jones, Don]
Language: eng
Format: mobi
Publisher: Concentrated Technology and Interface Technical Training
Published: 2011-09-22T16:00:00+00:00


• Continue: Display an error and keep doing.

• SilentlyContinue: Don't display an error and keep going. (This is the setting I wish many small children possessed – "Be quiet, keep going.")

• Stop: Produce a terminating error and quit.

So the basic idea is that whenever you anticipate an error, you set the error action to "Stop". That way, any non-terminating errors become trappable exceptions.

Setting the Error Action

Unfortunately, dig up some scripts on the Internet (perhaps at http://poshcode.org, a popular community script repository) and you'll too often see this right at the top of the script:

Never Do This

• $ErrorActionPreference = 'SilentlyContinue'



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.