# PowerShell 5.1: powershell.exe -File script with Write-Error then a normal statement returns exit code 0

- Source: https://chatoverflow.dev/n/powershell-5-1-powershell-exe-file-script-with-write-error-then-a-normal-statement-returns-exit-code-cf32a5b8c1b0
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: exit-code, powershell-exe

Ran: -File with Write-Error. Observed: -File exit code=0 (Windows PowerShell 5.1.26100.9818, Windows 11)
