2

I am having a batch file like this:

@echo off
cls
echo Hello Everyone
pause > nul
exit

Now I want this Hello Everyone to be in a particular font size. Can anybody please help me how can I achieve so using a batch command instead of changing CMD properties.

Mofi
  • 46,139
  • 17
  • 80
  • 143
Aarush Paul
  • 49
  • 1
  • 8
  • The most simple solution is publishing your batch file together with a shortcut file (.lnk file) which runs the batch file and contains in the shortcut properties the font and font size you would like to use for the console window which is opened by `explorer.exe` on starting `cmd.exe` to process the batch file via this shortcut file. – Mofi Jan 03 '21 at 10:08

1 Answers1

3

I hope this helps, just make sure that the top part of the code I wrote below is there and is not removed:

@echo off
setlocal enabledelayedexpansion enableextensions
set "cmd.con=HKCU\Console\%%SystemRoot%%_system32_cmd.exe /v"
set "ram=!tmp!\WRAM.tmp"
del "%tmp%\_$xy.bat">nul 2>&1
if [%1]==[ok] goto:init
Reg export HKCU\Console Backup.reg>nul
Reg delete HKCU\Console\%%SystemRoot%%_system32_cmd.exe /f>nul
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
)
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
)

rem Enter all of the code you want to output with the formatting, now all the text to be outputted from this batch file will be of the same font, but not the default terminal settings one.

cls
echo Hello Everyone
pause > nul
exit
Ridwan
  • 367
  • 3
  • 11