[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理从txt中查找字符的下一行失败了

  1. for /f "delims=:" %%a in ('findstr /n msmg设置 ..\set.txt') do set n=%%a
  2. for /f "skip=%n% delims=" %%b in (..\set.txt) do (
  3. set MT=%%b\Mount\Install
  4. set dism=%%b\Bin\x64\DISM10\dism.exe
  5. )
  6. for /f "delims=:" %%a in ('findstr /n win版本 ..\set.txt') do set n=%%a
  7. for /f "skip=%n% delims=" %%b in (..\set.txt) do (
  8. set win=%%b
  9. )
  10. echo %MT%
  11. echo %win%
  12. pause
复制代码
要显示“msmg设置”的下一行,”win版本”的下一行
从运行结果来看,都是显示的最后一行。。。。。

  1. for /f "delims=:" %%a in ('findstr /n msmg设置 ..\set.txt') do set n=%%a
  2. for /f "skip=%n% delims=" %%b in (..\set.txt) do (
  3. set MT=%%b\Mount\Install
  4. set dism=%%b\Bin\x64\DISM10\dism.exe
  5. goto next1
  6. )
  7. :next1
  8. for /f "delims=:" %%a in ('findstr /n win版本 ..\set.txt') do set n=%%a
  9. for /f "skip=%n% delims=" %%b in (..\set.txt) do (
  10. set win=%%b
  11. goto next2
  12. )
  13. :next2
  14. echo %MT%
  15. echo %win%
  16. pause
复制代码
1

评分人数

微信:flashercs
QQ:49908356

TOP

  1. for /f "delims=:" %%a in ('findstr /n msmg设置 ..\set.txt') do set n=%%a
  2. (for /l %%a in (0,1,%n%) do (set /p line=))<..\set.txt
  3. set MT=%line%\Mount\Install
  4. set dism=%line%\Bin\x64\DISM10\dism.exe
  5. for /f "delims=:" %%a in ('findstr /n win版本 ..\set.txt') do set n=%%a
  6. (for /l %%a in (0,1,%n%) do (set /p line=))<..\set.txt
  7. set win=%line%
  8. echo %MT%
  9. echo %win%
  10. pause
复制代码
1

评分人数

TOP

返回列表