【问题标题】:How to change font size from a batch file? [duplicate]如何从批处理文件更改字体大小? [复制]
【发布时间】:2021-01-03 07:12:47
【问题描述】:

我有一个这样的批处理文件:

@echo off
cls
echo Hello Everyone
pause > nul
exit

现在我希望这个Hello Everyone 具有特定的字体大小。谁能帮助我如何使用批处理命令而不是更改 CMD 属性来实现。

【问题讨论】:

  • 最简单的解决方案是将批处理文件与运行批处理文件的快捷方式文件(.lnk 文件)一起发布,并在快捷方式属性中包含您希望用于由explorer.exe 在启动cmd.exe 时打开的控制台窗口,通过此快捷方式文件处理批处理文件。

标签: batch-file cmd


【解决方案1】:

我希望这会有所帮助,只需确保我在下面编写的代码的顶部存在并且没有被删除:

@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

【讨论】:

  • 哦,所以我应该这样做..
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-06-10
  • 2017-07-17
  • 1970-01-01
  • 1970-01-01
  • 2016-05-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多