Page 1 of 1

Increasing text size in a batch file

Posted: 14 Dec 2022 12:27
by back_slash
Hi I'm making a program in batch and I need the text to be bigger without altering anything at the properties menu.
It doesn't matter if it's an external command or pure batch, anything works.
Thanks

Re: Increasing text size in a batch file

Posted: 14 Dec 2022 22:59
by arjunae
its been quite a while now since i had a similar problem. i found the following example code which dynaically modifies the registry. Maybe it helps

Code: Select all

  @echo off

  setlocal enabledelayedexpansion enableextensions
  set "cmd.con=HKCU\Console\%%SystemRoot%%_system32_cmd.exe /v"
  Reg delete HKCU\Console\%%SystemRoot%%_system32_cmd.exe /f>nul
  
  REM dont reentrant
  if [%1]==[ok] goto:init
  
  for %%a in (
    "FaceName /t REG_SZ /d "Terminal" /f" "FontFamily /t REG_DWORD /d 48 /f" "FontSize /t REG_DWORD /d 1024294 /f" "FontWeight /t REG_DWORD /d 700 /f" "ScreenBufferSize /t REG_DWORD /d 13107280 /f" "CursorSize /t REG_DWORD /d 0 /f"
  ) do (
    set "param=%%a" & set "param=!param:~1!" & set "param=%cmd.con% !param:~0,-1!" & Reg Add !param! >nul
  )
 echo  %~0
 pause
 start /high cmd /q /k "%~0" ok
  for %%a in (
    "FaceName /f" "FontFamily /f" "FontSize /f" "FontWeight /f" "CursorSize /f"
  ) do (
    set "param=%%a" & set "param=!param:~1!" & set "param=%cmd.con% !param:~0,-1!" & Reg Delete !param! >nul
  )
  
:init
I opted to simply import a static registry file

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Console\TinyTonCMD]
"FaceName"="Consolas"
"FontSize"=dword:000d0000
"ScreenColors"=dword:0000000a
"WindowAlpha"=dword:000000e7
"ColorTable00"=dword:00FFFFFF
"ColorTable10"=dword:0000c400
"ScreenBufferSize"=dword:07d0005f
"WindowSize"=dword:000e005f
"FullScreen"=dword:00000000
"HistoryNoDup"=dword:00000001

Code: Select all

reg import tinytonCMD.reg
start "TinyTonCmd"
regards, arjunae

Re: Increasing text size in a batch file

Posted: 15 Dec 2022 08:14
by back_slash
thx ill try it

Re: Increasing text size in a batch file

Posted: 15 Dec 2022 08:41
by atfon
This topic may be of interest:

viewtopic.php?t=10156

Re: Increasing text size in a batch file

Posted: 15 Dec 2022 08:44
by back_slash
There is only one problem. How do I run code that I have already made with this preset?
for example, i tried to do
@echo off
reg import tinytonCMD.reg
cd Kernel
start "game.bat"
exit
That doesn't work for some reason, it will start the game without the preset in the registry file. It works fine with start "TinytonCMD".
In shorter terms, I'm trying to run premade code with this preset on. Is it possible?

Re: Increasing text size in a batch file

Posted: 15 Dec 2022 13:23
by arjunae
Edit As far as i know theres no dos api for directly applying changed registry Font settings.
tinyton is just a profile name for start to use for the interpreter. a static solution would be start "profile" cmd /c batch which is what i used but as atfon posting the link using escapes i will try that.
removed noisy code so its clear which option should be preferred.

Re: Increasing text size in a batch file

Posted: 15 Dec 2022 13:58
by atfon
Once again, see this post for how to set the font size and name in the Console:

viewtopic.php?t=10156

There are multiple posts out there on how to change the font color of individual words. For example, see this one to change the font color:

https://stackoverflow.com/questions/433 ... batch-file

To change font color with terminal escape sequences (Requires Windows 10 and later):

Code: Select all

REM Set an escape character
for /f %%e in ('echo prompt $E^|cmd') do set "\e=%%e"
set "redCol=%\e%[91m"
set "norCol=%\e%[97m"
echo This is %redCol%red. %norCol%This is not.
Terminal Escape Sequences:

https://learn.microsoft.com/en-us/windo ... -sequences

Re: Increasing text size in a batch file

Posted: 15 Dec 2022 14:13
by arjunae
thanks - didnt knew that!