本帖最后由 zh_1452 于 2014-6-22 16:10 编辑
- @echo off
- type nul>e:\test.txt
- set /p str=123456789>e:\test.txt
- for %%i in (123.456.789) do echo %%i
- pause
- @echo off
- for %%i in (123,456,789) do echo %%i
- pause
- @echo off
- type nul>test.txt
- set /p str=258>e:\test.txt
- for %%i in (2,5,8) do echo %%i
- pause
- @echo off
- type nul>e:\test.txt
- set /p str=床前明月光,疑是地上霜,举头望明月,低头思故乡>e:\test.txt
- for %%i in (床前明月光,疑是地上霜,举头望明月,低头思故乡) do echo %%i
- pause
- @echo off
- cd..\..
- cd /d c:\.&attrib *.txt
- find /i "mplayer" c:\windows\system32\*.txt
- pause
- @echo off
- type nul>123.txt
- set /p str=3,4,5,6,7,9,9,9,10,10,>c:\program files\123.txt
- for %%i in (3,4,5,6,7,9,9,9,10,10,) do echo %%i
- pause
- @echo off
- set /p var=顺子
- set /p str=3,4,5,6,
- if defined str (echo 变量str已经被赋值,其值为%str%) else (echo 变量str的值为3,4,5,6,)
- if defined var (echo 变量var已经被赋值,其值为%var%) else (echo 变量var的值为顺子)
- pause
- @echo off
- set /p var=三带二
- set /p str=9,9,9,10,10,
- if defined str (echo 变量str已经被赋值,其值为%str%) else (echo 变量str的值为9,9,9,10,10,)
- if defined var (echo 变量var已经被赋值,其值为%var%) else (echo 变量var的值为三带二)
- pause
复制代码
|