Powershell의 Write-Error
cmdlet이 저에게 맞지 않는 이유는 무엇입니까?쓰기 오류를 사용하여 Powershell의 오류 스트림에 쓰기
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
에 : 나는 예외를 참조하지 않아야 생각 Write-Error
및 about_preference_variables
문서에서
PS H:\> Write-Warning "This is a warning"
WARNING: This is a warning
내 출력 문서의 예제처럼 보이지 않는 ?
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.
당신이 출력에서 볼 무엇을 기대합니까? 네가 올린 글은 내게 완벽하게 정상적으로 보인다. –
@zespri 필자는 Write-Warning과 비슷한 것을 기대하고 있었지만, 예제를 포함하도록 질문을 편집했습니다. –
보고있는 출력이 정확합니다. 출력이 v2.0 IIRC로 변경되어 좀 더 자세한 정보가 표시됩니다. 처음 발생한 문서가 아닌 문서가 잘못되었습니다. :-) –