[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off
  2. echo "you are my super star!">test.txt
  3. echo "you are :my super star!">>test.txt
  4. echo "you are my super star!">>test.txt
  5. echo.
  6. @echo off
  7. ::去引号
  8. setlocal EnableDelayedExpansion
  9. for /f "tokens=* delims=" %%i in (test.txt) do (
  10.     set var=%%i
  11.     set var=!var:"=!
  12.     echo !var!>>ls.txt
  13.      
  14. )
  15. pause
  16. echo.
  17. @echo off
  18. ::去冒号
  19. setlocal EnableDelayedExpansion
  20. for /f "tokens=* delims=" %%i in (ls.txt) do (
  21.     set var=%%i
  22.     set var=!var::=!
  23.     echo !var!>>ls1.txt
  24.      
  25. )
  26. pause
  27. echo.
  28. ::把my替换为my (not you)
  29. @echo off
  30. setlocal EnableDelayedExpansion
  31. for /f "tokens=* delims=" %%i in (ls1.txt) do (
  32.     set var=%%i
  33.     set var=!var:my=my ^(not you^)!
  34.     echo !var!
  35.      
  36. )
  37. echo.
  38. pause
复制代码
把set var=!var:my=my (not you)!
改成这样试试
set var=!var:my=my ^(not you^)!

TOP

返回列表