There is a way to change the font size in cmd (batch file): Change the value of the keys in "HKCU\Console".
I create a batch file to help those who need it(copy the code below and insert your code in,then save the file as a .bat file)
@echo off
set /a fontSize=32
:: unset %SystemRoot% as the variate affect the execution of 'reg delete' in command line
set SystemRootA=%System
set SystemRootB=Root%
set SystemRoot=%SystemRootA%%SystemRootB%
title Font Settings by TYAI 2022.6.20
reg query "HKCU\Console"|find /i "FaceName"&&cls&&goto :found_Font_settings||cls&&goto :change_Font_settings
goto :eof
:found_Font_settings
::######################################
::put your code in this section
::######################################
title Font Settings
mode con cols=30 lines=5
echo Hello, World!
ping 127.0.0.1 >nul
:: clear font settings before exit
goto :clear_Font_settings
exit 0
:change_Font_settings
::set /p fontSize=Enter the size[default:%fontSize%]:
::reg add "HKCU\Console" /v "CodePage" /t REG_DWORD /d "0x000003a8" /f >nul
reg add "HKCU\Console" /v "FontSize" /t REG_DWORD /d "0x00%fontSize%0000" /f >nul
reg add "HKCU\Console" /v "FontWeight" /t REG_DWORD /d "0x00000190" /f >nul
reg add "HKCU\Console" /v "FaceName" /t REG_SZ /d "新宋体" /f >nul
::reg add "HKCU\Console" /v "FontFamily" /t REG_DWORD /d "0x00000036" /f >nul
start "" "%0"
exit 0
:clear_Font_settings
reg delete "HKCU\Console" /v "CodePage" /f 1>nul 2>nul
reg delete "HKCU\Console" /v "FontSize" /f 1>nul 2>nul
reg delete "HKCU\Console" /v "FontWeight" /f 1>nul 2>nul
reg delete "HKCU\Console" /v "FaceName" /f 1>nul 2>nul
reg delete "HKCU\Console" /v "FontFamily" /f 1>nul 2>nul
exit 0