$x=100 $y=0 try { Write-Host "$x / $y = $($x/$y)" } catch { Write-Host "Przepraszam - Wystąpił błąd" $Error[0] "------------------------" | Out-File C:\Users\errors.txt -Append Get-Date | Out-File C:\Users\errors.txt -Append $Error[0] | Out-File C:\Users\errors.txt -Append } Get-Content C:\Users\errors.txt