Neden Powershell'in Write-Error
cmdlet'i çalışmıyor?Write-Error kullanarak Powershell'de hata akışına yazma
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
Ben benzer çıktı beklediklerinden
Write-Warning
için: Ben herhangi bir istisna görmemeniz gerekir düşünce Write-Error
ve about_preference_variables
belgelerine
PS H:\> Write-Warning "This is a warning"
WARNING: This is a warning
Benim çıkış belgelerinde örneklere benzemiyor ?
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.
çıktıda ne görmeyi bekliyorsunuz? Deftere kimse benimle gayet normal görünüyor. –
@zespri Yazma-Uyarı ile benzer bir şey bekliyordum ... Soruyu bir örnek ekledim. –
Gördüğünüz çıktı doğru. Çıkış, biraz daha ayrıntılı olmak için v2.0 IIRC ile değişti. Belgeler yanlış - ilk defa değil. :-) –