Increasing text size in a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
back_slash
Posts: 19
Joined: 20 Aug 2021 08:07

Increasing text size in a batch file

#1 Post by back_slash » 14 Dec 2022 12:27

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

arjunae

Re: Increasing text size in a batch file

#2 Post by arjunae » 14 Dec 2022 22:59

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

back_slash
Posts: 19
Joined: 20 Aug 2021 08:07

Re: Increasing text size in a batch file

#3 Post by back_slash » 15 Dec 2022 08:14

thx ill try it

atfon
Posts: 178
Joined: 06 Oct 2017 07:33

Re: Increasing text size in a batch file

#4 Post by atfon » 15 Dec 2022 08:41

This topic may be of interest:

viewtopic.php?t=10156

back_slash
Posts: 19
Joined: 20 Aug 2021 08:07

Re: Increasing text size in a batch file

#5 Post by back_slash » 15 Dec 2022 08:44

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?

arjunae

Re: Increasing text size in a batch file

#6 Post by arjunae » 15 Dec 2022 13:23

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.
Last edited by arjunae on 15 Dec 2022 14:17, edited 2 times in total.

atfon
Posts: 178
Joined: 06 Oct 2017 07:33

Re: Increasing text size in a batch file

#7 Post by atfon » 15 Dec 2022 13:58

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

arjunae

Re: Increasing text size in a batch file

#8 Post by arjunae » 15 Dec 2022 14:13

thanks - didnt knew that!

Post Reply