Почему не работает оператор PowerShell Write-Error
? Мой вывод не похож на примеры в документации:
PS C:\> Write-Error "This is an error"
Write-Error "This is an error" : This is an error
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Я ожидал выхода, похожего на Write-Warning
:
PS H:\> Write-Warning "This is a warning"
WARNING: This is a warning
Из документации Write-Error
и about_preference_variables
я думал, что не вижу никаких исключений?
PS H:\> Get-Help About_Preference_Variables
$ErrorActionPreference
----------------------
...
PS> $erroractionpreference
Continue # Display the value of the preference.
PS> write-error "Hello, World"
# Generate a non-terminating error.
write-error "Hello, World" : Hello, World
# The error message is displayed and
execution continues.
PS> write-error "Hello, World" -ErrorAction:SilentlyContinue
# Use the ErrorAction parameter with a
value of "SilentlyContinue".
PS>
# The error message is not displayed and
execution continues.