用了 chcp 65001 也不行
我的实验脚本如下
@echo off
SETLOCAL EnableDelayedExpansion
chcp 65001 >nul
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
set "text=什么"
echo %text%
call :ColorText 0c "%text%"
call :ColorText 0c "shen me"
pause
:ColorText
echo off
echo %DEL% > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof
echo 能正常显示“什么”,call :ColorText 0c "%text%"就不行
颜色代码来自前两个最高分回答
https://stackoverflow.com/questions/21660249/how-do-i-make-one-particular-line-of-a-batch-file-a-different-color-then-the-oth
我看不懂原本那个改颜色代码的原理,所以想请问一下大家有没有解决的办法?
谢谢