@call :__testecho
@if %errorlevel% EQU 1 (
set __echo_status__=1
) else (
set __echo_status__=0
)
@goto __end
:__testecho
@set opened=打开状态
@set closed=关闭状态
@echo | findstr %opened% > nul
@if %errorlevel% EQU 0 exit /b 1
@echo | findstr %closed% > nul
@if %errorlevel% EQU 0 exit /b 0
@exit /b 0
:__end
调用这面的批处理代码后,就可以正常echo off了,处理完毕,再根据__echo_status__即可还原