Windows Terminal scroll back when opened by .bat file #15897

Closed
opened 2026-01-31 04:51:35 +00:00 by claunia · 6 comments
Owner

Originally created by @Babscoole on GitHub (Nov 17, 2021).

Windows Terminal version

1.12.2931.0

Windows build number

10.0.22000.346

Other Software

No response

Steps to reproduce

In settings for Windows Terminal, set scrollbar visibility to Visible. Set History size to at least 9001. Set Default terminal application to Windows Terminal. When I open a Command Prompt in windows terminal, I can scroll back if the input/output goes beyond a page, as expected. If a command prompt is opened in Windows Terminal by running a .bat file, scrollback does not work.

Expected Behavior

Scrollback functionality when a .bat file opens a command prompt in windows terminal.

Actual Behavior

No scrollback

Originally created by @Babscoole on GitHub (Nov 17, 2021). ### Windows Terminal version 1.12.2931.0 ### Windows build number 10.0.22000.346 ### Other Software _No response_ ### Steps to reproduce In settings for Windows Terminal, set scrollbar visibility to Visible. Set History size to at least 9001. Set Default terminal application to Windows Terminal. When I open a Command Prompt in windows terminal, I can scroll back if the input/output goes beyond a page, as expected. If a command prompt is opened in Windows Terminal by running a .bat file, scrollback does not work. ### Expected Behavior Scrollback functionality when a .bat file opens a command prompt in windows terminal. ### Actual Behavior No scrollback
Author
Owner

@zadjii-msft commented on GitHub (Nov 17, 2021):

Interesting. Do you have an example bat file you can share? Could you share your settings.json file? I can't seem to repro this locally...

@zadjii-msft commented on GitHub (Nov 17, 2021): Interesting. Do you have an example `bat` file you can share? Could you share your [settings.json file](https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#where-can-i-find-the-settings-file)? I can't seem to repro this locally...
Author
Owner

@Babscoole commented on GitHub (Nov 18, 2021):

settings.txt
Renamed to .txt for drag and drop support.

The bat is part of a package to execute and compile LUA scripts. https://github.com/HolterPhylo/AMUMSS. Download, extract, run BUILDMOD.BAT

That you can't repo, gives me hope that it's just some kind of configuration issue.

@Babscoole commented on GitHub (Nov 18, 2021): [settings.txt](https://github.com/microsoft/terminal/files/7558838/settings.txt) Renamed to .txt for drag and drop support. The bat is part of a package to execute and compile LUA scripts. https://github.com/HolterPhylo/AMUMSS. Download, extract, run BUILDMOD.BAT That you can't repo, gives me hope that it's just some kind of configuration issue.
Author
Owner

@zadjii-msft commented on GitHub (Nov 18, 2021):

Well, you've got "historySize": 20000,, which is totally reasonable. It's in the defaults block, so opening up the Terminal directly by clicking on the bat file should use that setting. That should work.

The bat file is more interesting.

and those do... quite a lot. Not necessarily a minimal repro.

@zadjii-msft commented on GitHub (Nov 18, 2021): Well, you've got `"historySize": 20000,`, which is totally reasonable. It's in the defaults block, so opening up the Terminal directly by clicking on the bat file should use that setting. That should work. The bat file is more interesting. * [`BUILDMOD.bat`](https://github.com/HolterPhylo/AMUMSS/blob/52694d7ff6bf5df2666f67d92de96b8273fa2f0c/AMUMSS-3.9.4W/BUILDMOD.bat) calls to: * [`bzrun.bat`](https://github.com/HolterPhylo/AMUMSS/blob/52694d7ff6bf5df2666f67d92de96b8273fa2f0c/AMUMSS-3.9.4W/bzrun.bat) and those do... quite a lot. Not necessarily a minimal repro.
Author
Owner

@zadjii-msft commented on GitHub (Feb 18, 2022):

Sorry we haven't had more of a chance to investigate this. Any chance you could try something that's a more minimal repro? Trying to read a 2k+ line batch file to look for a bug isn't really feasible. For example, something as simple as

echo foo

for /L %%i  IN (0,1,100000) DO echo Line %%i 

pause

(in a bat file)

doesn't seem to repro this for me. Does that work fine for you?

@zadjii-msft commented on GitHub (Feb 18, 2022): Sorry we haven't had more of a chance to investigate this. Any chance you could try something that's a more minimal repro? Trying to read a 2k+ line batch file to look for a bug isn't really feasible. For example, something as simple as ```bat echo foo for /L %%i IN (0,1,100000) DO echo Line %%i pause ``` (in a bat file) doesn't seem to repro this for me. Does that work fine for you?
Author
Owner

@Babscoole commented on GitHub (Feb 18, 2022):

Good afternoon. Yes that works fine, can scroll through the output. I believe the problem lies in one .bat calling open another .bat in the same terminal window., or at least the way it's being done here using start versus call.

@Babscoole commented on GitHub (Feb 18, 2022): Good afternoon. Yes that works fine, can scroll through the output. I believe the problem lies in one .bat calling open another .bat in the same terminal window., or at least the way it's being done here using start versus call.
Author
Owner

@zadjii-msft commented on GitHub (Mar 3, 2022):

That's entirely possible, but with how big that script is it'd be impossible to narrow it down to be sure. My guess is that this has something to do with the fact that they're using ansicon instead of just using the Console's built in support for VT sequences.

52694d7ff6/AMUMSS-3.9.4W/BUILDMOD.bat (L63)

Of course, if you can come up with a more minimal repro, I'd be happy to take a look.

@zadjii-msft commented on GitHub (Mar 3, 2022): That's entirely possible, but with how big that script is it'd be impossible to narrow it down to be sure. My _guess_ is that this has something to do with the fact that they're using `ansicon` instead of just using the Console's built in support for VT sequences. https://github.com/HolterPhylo/AMUMSS/blob/52694d7ff6bf5df2666f67d92de96b8273fa2f0c/AMUMSS-3.9.4W/BUILDMOD.bat#L63 Of course, if you can come up with a more minimal repro, I'd be happy to take a look.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15897