Retrieve the exit code of a piped executable in Windows CMD or PowerShell by using ERRORLEVEL, $LASTEXITCODE, or temporary files to avoid shell masking.