Created
July 5, 2019 16:44
-
-
Save PrateekKumarSingh/83f27a15c1f975325c89dee7507ed57c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Error.count # empty automatic variable | |
# throwing an error when file doesn't exists | |
Get-Item C:\Data\nosuchfile.txt | |
$Error.count # one error record logged | |
# supressing the error | |
Get-Item C:\Data\nosuchfile.txt -ErrorAction SilentlyContinue | |
$Error.count # but still capturing the error | |
# supress the error but not logging it in $Error variable | |
Get-Item C:\Data\nosuchfile.txt -ErrorAction Ignore | |
$Error.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment