Powershell window disappears before I can read the error message May 11, 2023 by Tarik Try with the -noexit switch: powershell -noexit d:\script\foo.ps1