Hide Error Messages

by Mar 19, 2010

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!