我想遍历文本文件中的每个字符以在屏幕上显示它,因为屏幕的每个字符都是一个单独的变量,请帮忙 .

目标:我想写一些像 call :getchar (file) (line) (column) 的东西,我知道如何从文本文件中获取一行,但不是一个字符 .

PS:我放弃了

PPS:我找到了答案:

@echo off

call :Getchar text.txt 1 2
set "k="
set /p k=<out.txt
del out.txt
:: do stuff with the output (eg: echo %k%)
pause
goto :eof

:Getchar
set f=%1
set l=%2
set c=%3
set /a c=%c%-1
set "a="
for /F "skip=%l% delims=" %%i in (%f%) do if not defined a set "a=%%i"
echo ^@echo off> temp.bat
echo set d^=%a%>>temp.bat
echo echo %%d:~%c%,1%% >>temp.bat
call temp.bat > out.txt
del temp.bat