变量延迟因为之前好像看到这样一个代码- @echo off
- :main
- cls
- set str=
- set /p str= 请输入字符串(退出请直接按回车):
- if not defined str exit
- cls
- echo.
- echo 转换前:"%str%"
- for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call set str=%%str:%%i=%%i%%
- echo ____________________________________________
- echo.
- echo 转换后:"%str%"
- echo.
- echo 按任意键进行下一次演示...
- pause>nul
- goto main
复制代码 似乎跟下面这样是一样的- setlocal enabledelayedexpansion
- for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call set str=!str:%%i=%%i!
复制代码
|