我發現找 "%" 問題是小 , 但是就是找不了 "!"
保存為文件123.txt- @echo off
- echo %var%
- echo !var!
- pause
复制代码 例子1︰找% (成功)- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('type 123.txt') do (
- echo %%a|findstr "%%">nul && (echo yes)
- echo %%a|findstr "%%">nul || (echo no)
- )
- pause
- exit
复制代码 例子2︰找! (失敗...)- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('type 123.txt') do (
- echo %%a|findstr "\!">nul && (echo yes)
- echo %%a|findstr "\!">nul || (echo no)
- )
- pause
- exit
复制代码
[ 本帖最后由 strong12345 于 2009-8-19 08:39 编辑 ] |