[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
延迟出错 更改
  1. @echo off
  2. for /f "tokens=*" %%i in (a.txt) do if not defined str (set str=%%i)else call set str=%%str%% %%i
  3.     set str=%str:your=_%
  4.     set str=%str:you=me%
  5.     set str=%str:_=your%
  6.     set str=%str::=:#%
  7.     set str=%str:.=.#%
  8.     set str=%str:Looking for a job is one of the toughest things me will ever have to do.=bathomework is a nice job,%
  9.     set str=%str:#=^&^>^>b.txt echo. %
  10.     >>b.txt echo.%str%
  11.     pause
复制代码


[ 本帖最后由 terse 于 2008-8-30 20:45 编辑 ]

TOP

1
  1. @echo off
  2. for /f "delims=" %%a in (a.txt) do call set "str=%%str%%%%a"
  3. set "str= %str% "
  4. set "str=%str: you = me %"
  5. set "str=%str: you. = me. %"
  6. echo %str:~1,-1%
  7. pause
复制代码
2
  1. @echo off
  2. for /f "delims=" %%a in (a.txt) do call set "str=%%str%%%%a"
  3. set "str=%str::=:&echo\ %"
  4. set "str=%str:.=.&echo\ %"
  5. (echo %str%)>>b.txt
  6. start "" "b.txt"
复制代码


[ 本帖最后由 随风 于 2008-8-30 17:57 编辑 ]
2

评分人数

    • keen: 强!!!PB + 7
    • batman: 小楼兄就是强PB + 15
技术问题请到论坛发帖求助!

TOP

才发现set功能如此强大,看了这贴子并参与进去,学到了很多!
要是有多些这样的训练就好了,自己想训练自己可是没有一点目标!
更加也发现不了自己的缺项,希望多点讲解……
貌似你们就发了贴,还不明白为什么就要这样用……
要想提高多做,多想,多问!
空间http://www.wangwei4106.ys168.com

TOP

  1. @echo off&setlocal enabledelayedexpansion
  2. set /p str=<1.txt
  3. for %%a in (%str%) do (
  4.         set var=%%a
  5.         set a=!var:~0,4!
  6.         if "!a!"=="you" set var=!var:you=me!
  7.         set "str1=!str1!!var! "
  8. )
  9. set "str1=%str1::=:&echo\ %"
  10. set "str1=%str1:.=.&echo\ %"
  11. echo %str1:you.=me.%&pause
复制代码

[ 本帖最后由 keen 于 2009-5-14 14:04 编辑 ]
(*^_^*)

TOP

  1. @echo off
  2. for /f "delims=" %%i in (a.txt) do ( set "str=%%i" )
  3. set str=%str:your=####%
  4. set str=%str:you=me%
  5. set str=%str:####=your%
  6. set str=%str::=:^^^&echo, %
  7. set str=%str:.=.^&echo,  %
  8. (echo %str%)>>b.txt
  9. for /f "delims=" %%i in (b.txt) do (
  10.     if "%%i"=="  Looking for a job is one of the toughest things me will ever have to do." (
  11.         echo,  bathomework is a nice job.
  12.     ) else (
  13.         echo,%%i
  14.     )
  15. )
复制代码

TOP

返回列表