I would like to make a *.bat file which can act differently according to the window size of the CMD.
I searched for a way to find the window size which is mostly the same but some times when people customize the settings its not the same. Normally the window size is 80 characters width and 25 lines height. But some apply their own custom settings so it could be any thing else.
Is there a way from inside of a *.bat to find the actual window size? I would like to keep it as much *.bat as possible ... with other words not PowerShell or vbs and so on and the best would also be without *.tmp files.
This would interest me the most. But also interesting would be a way to find the buffer size of a running *.bat in it self.
Is there any way or idea to get this information from inside of a *bat?
Alternative may would be to adjust the window size or buffer size from a *.bat file it self. So if I can't get the actual window or buffer size is it possible to set a window or buffer size in a running *.bat while it is processed?
Does any one have a trick or even idea on how to get or set this information from inside of a running *.bat?
Until now I have no idea if it is possible and how? so I could not try much that I could show now.
UPDATE:
REM Empty Variables
set "ROWS="
set "CHARACTERS="
REM Read CMD Window Size in Rows and Characters per Row.
for /F "tokens=3" %%A in ('reg query HKCU\Console /v WindowSize') do set /A ROWS=%%A/65535
for /F "tokens=3" %%A in ('reg query HKCU\Console /v WindowSize') do set /A "CHARACTERS=%%A&0xffff
REM Test it ...
echo %ROWS%
echo %CHARACTERS%
This will read the rows and characters per line from the registry. its a shortened form from https://superuser.com/questions/1330772/cmd-window-size