您好,可启用变量延迟,利用变量的表示差异实现:
@echo offsetlocal enabledelayedexpansionset oldpath=%path%set bbb=%JAVA_HOME%\binecho !oldpath:%bbb%=!pause