Hide Error Messages

You may already know that you can suppress error messages with the ErrorAction parameter, which is often a good idea. Take a look at this and then try the line with and without ErrorAction:

dir $env:windir *.log -Recurse -ErrorAction SilentlyContinue

Unfortunately, this is a lot of typing. You can try this for a quicker way:

dir $env:windir *.log -Recurse -ea 0

Twitter This Tip! ReTweet this Tip!


Posted Mar 19 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.