
求助批處理使用了chcp65001仍在特殊情況下亂碼且報(bào)錯(cuò)我在腳本中用到了中文,并添加了chcp 65001命令,文件保存為UTF 8,cmd字體是默認(rèn)的新宋體,在大部分情況下都能正常運(yùn)行,結(jié)果遇到了下面這種特殊的情況出現(xiàn)了報(bào)錯(cuò)
報(bào)錯(cuò)內(nèi)容:nclick="copycode($('code0'));">復(fù)制代碼
- @echo off
- chcp 65001 > nul
- set i=1
- rem 輪詢,等待服務(wù)啟動(dòng)
- :wait_loop
- echo %i%
- set /a i+=1
- if %i% lss 4 (
- goto :wait_loop
- )
- pause
我嘗試了發(fā)現(xiàn)將“rem 輪詢,等待服務(wù)啟動(dòng)”改成“rem 撒旦撒服務(wù)啟動(dòng)”或其他可以正常;或者將“chcp 65001 > nul ”去掉,然后保存成GBK編碼可以正常;再或者在“rem 輪詢,等待服務(wù)啟動(dòng)”下方插入一行空白行也能正常運(yùn)行。在我看來這種非常詭異,請(qǐng)問是隱藏的bug還是有我還沒了解清除的規(guī)則?求解答,謝謝。nclick="copycode($('code1'));">復(fù)制代碼
- 1
- '�動(dòng)' is not recognized as an internal or external command,
- operable program or batch file.
- 2
- '�動(dòng)' is not recognized as an internal or external command,
- operable program or batch file.
- 3
- Press any key to continue . . .

