标题: [文本处理] [已解决]批处理变量延迟为何提示参数无效? [打印本页]
作者: hucuibai 时间: 2011-4-22 14:24 标题: [已解决]批处理变量延迟为何提示参数无效?
- @echo off&setlocal enabaledelayedexpansion
- path E:\GameRecord\hucuibai;%path%
- for /r E:\GameRecord %%i in (*.txt) do (
- for /f "tokens=7 delims=\" %%a in ("%%i") do (set str=%%a&echo !str!)
- )
- pause
复制代码
目录结构是
E:\GameRecord\hucuibai\Thu\G\gamerecord\gamerecord-chn1030\20110101\onlinetimerecord20110101.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\gamerecord-chn1030\20110101\PlayerLogonLog20110101.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\gamerecord-chn1030\20110101\PlayerPropertyLog20110101.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\gamerecord-chn1030\20110101\serverinfo20110101.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\gamerecord-chn1030\20110101\starLevelInfoLog20110101.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\rxkl-gamerecord-1020\20110121\itemrecord20110121.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\rxkl-gamerecord-1020\20110121\onlinetimerecord20110121.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\rxkl-gamerecord-1020\20110121\PlayerLogonLog20110121.txt
E:\GameRecord\hucuibai\Thu\G\gamerecord\rxkl-gamerecord-1020\20110121\serverinfo20110121.txt
错误提示:
对 SETLOCAL 命令来说参数是无效的。
!str!
!str!
!str!
!str!
!str!
!str!
!str!
!str!
!str!
!str!
!str!
!str!
作者: hucuibai 时间: 2011-4-22 14:25
我直接echo %%a是没有问题的,高手赐教!
作者: batman 时间: 2011-4-22 14:46
检查这个:setlocal enabaledelayedexpansion
作者: hucuibai 时间: 2011-4-22 14:51
3# batman
晕死 害我搞半天!
谢谢!!
我另外还有一个问题的!
麻烦帮我解答一下!
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |