Setting Terminal to default terminal app causes blank screen when running bat file #20098

Closed
opened 2026-01-31 07:03:33 +00:00 by claunia · 4 comments
Owner

Originally created by @ToxicSmurf on GitHub (Jun 15, 2023).

Windows Terminal version

1.18.1462.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

Settings > Default terminal application > Windows Terminal Preview
Run (any) .bat file

Expected Behavior

.bat file to run

Actual Behavior

error

error 2

Originally created by @ToxicSmurf on GitHub (Jun 15, 2023). ### Windows Terminal version 1.18.1462.0 ### Windows build number 10.0.19045.0 ### Other Software _No response_ ### Steps to reproduce Settings > Default terminal application > Windows Terminal Preview Run (any) .bat file ### Expected Behavior .bat file to run ### Actual Behavior ![error](https://github.com/microsoft/terminal/assets/97206988/664a7aad-4317-4a0c-b681-82efc59e9fe3) ![error 2](https://github.com/microsoft/terminal/assets/97206988/098bb10e-5309-481f-9d3c-af1a5bf8f3f7)
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 07:03:33 +00:00
Author
Owner

@lhecker commented on GitHub (Jun 15, 2023):

I think it's unlikely that any .bat file would run into this issue. After all, your screenshot shows an application error in pwsh.exe and .bat files are for cmd.exe. Could you provide us with a .bat file that reproduces the issue? If it involves calling into pwsh.exe, I'd also need the corresponding .ps1 script if possible.

@lhecker commented on GitHub (Jun 15, 2023): I think it's unlikely that any .bat file would run into this issue. After all, your screenshot shows an application error in pwsh.exe and .bat files are for cmd.exe. Could you provide us with a .bat file that reproduces the issue? If it involves calling into pwsh.exe, I'd also need the corresponding .ps1 script if possible.
Author
Owner

@ToxicSmurf commented on GitHub (Jun 16, 2023):

https://gist.github.com/ToxicSmurf/85923e79b8c2a9849bf6c525be504eec

@ToxicSmurf commented on GitHub (Jun 16, 2023): https://gist.github.com/ToxicSmurf/85923e79b8c2a9849bf6c525be504eec
Author
Owner

@lhecker commented on GitHub (Jun 16, 2023):

Ah, a fellow MPV user. 😏

That gist has two updater.bat files. You meant the MPV one, right? And it's the scripts from https://sourceforge.net/projects/mpv-player-windows/files/? I also use those, and I just tried running my local MPV's updater.bat and it worked fine. Did you modify your pwsh.exe in any way? Like, let's say, marking it as an adminstrator-only application via the properties page? Or is the mpv directory perhaps inaccessible for the script? Does the issue reproduce if you choose the "Windows Console Host" as the default terminal application in Windows Terminal's settings?

Given that 0xe0434352 is a .NET exception code that occurs in pwsh, I believe it's at least somewhat unlikely that this is a Windows Terminal bug.

But what's especially confusing for me is that your error message has "pwsh.exe" in the title, but the updater.bat file clearly spawns powershell.exe which is an entirely different application. This is all really confusing... 🤔

@lhecker commented on GitHub (Jun 16, 2023): Ah, a fellow MPV user. 😏 That gist has two updater.bat files. You meant the MPV one, right? And it's the scripts from https://sourceforge.net/projects/mpv-player-windows/files/? I also use those, and I just tried running my local MPV's updater.bat and it worked fine. Did you modify your pwsh.exe in any way? Like, let's say, marking it as an adminstrator-only application via the properties page? Or is the mpv directory perhaps inaccessible for the script? Does the issue reproduce if you choose the "Windows Console Host" as the default terminal application in Windows Terminal's settings? Given that 0xe0434352 is a .NET exception code that occurs in pwsh, I believe it's at least somewhat unlikely that this is a Windows Terminal bug. But what's especially confusing for me is that your error message has "pwsh.exe" in the title, but the `updater.bat` file clearly spawns `powershell.exe` which is an entirely different application. This is all really confusing... 🤔
Author
Owner

@ToxicSmurf commented on GitHub (Jun 17, 2023):

I added the second updater.bat file because the error was occurring when I tried to run it as well. You're right, though; it wasn't a Windows Terminal bug. My bad 😭 I had my ComSpec environment variable pointed to pwsh.exe for some reason. Reverting that fixed the issue. Sorry!

@ToxicSmurf commented on GitHub (Jun 17, 2023): I added the second `updater.bat` file because the error was occurring when I tried to run it as well. You're right, though; it wasn't a Windows Terminal bug. My bad 😭 I had my `ComSpec` environment variable pointed to `pwsh.exe` for some reason. Reverting that fixed the issue. Sorry!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20098