[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off
  2. set abc=今日明月在
  3. echo %abc%
  4. echo %abc:~4,1%%abc:~3,1%%abc:~2,1%%abc:~1,1%%abc:~0,1%
  5. echo %abc:~-1%%abc:~-2,1%%abc:~-3,1%%abc:~-4,1%%abc:~-5,1%
  6. echo %abc:~-1%%abc:~-2,-1%%abc:~-3,-2%%abc:~-4,-3%%abc:~-5,-4%
  7. pause>nul
复制代码

TOP

太棒了 又学习了新知识
  1. @echo off
  2. set "a=今日明月在"
  3. set a1=%a:~0,2%
  4. set a2=%a:~2,2%
  5. set a3=%a:~-1,1%
  6. echo %a2%%a1%%a3%
  7. pause>nul
复制代码

TOP

不知道还能再精简吗?

  1. @echo off
  2. set n=今日明月在
  3. echo n=%n%
  4. echo %n:~2,2%%n:~,2%%n:~-1%
  5. pause>nul
复制代码

TOP

答:
  1. @echo off
  2. ::=======A1====
  3. set Q=今日明月在
  4. echo %Q:~0,2%
  5. echo %Q:~2,2%
  6. echo %Q:~-1,1%
  7. ::=======A2====
  8. echo %Q:~2,2%%Q:~0,2%%Q:~-1,1%
  9. ::=======end===
  10. pause>nul
复制代码
效果:
[attach]2731[/attach]

是要这样么,题目没太懂...
==========
end;

TOP

  1. @echo off
  2. set str=今日明月在
  3. echo %str:~0,2%
  4. echo %str:~2,2%
  5. echo %str:~4,1%
  6. echo %str:~2,2%%str:~0,2%%str:~-1%
  7. pause
复制代码

TOP

set str=今日明月在
set s1=%str:~0,2%
set s1=%str:~2,2%

TOP

不知道怎么样?

  1. @echo off
  2. set str=今日明月在
  3. set var=%str:~2,2%%str:~0,2%%str:~-1,1%
  4. echo %var%
  5. pause
复制代码

TOP

  1. @echo off
  2. set m=今日明月在
  3. echo %m%
  4. pause
  5. set a=%m:~0,2%
  6. set b=%m:~2,2%
  7. set c=%m:~-1%
  8. echo %a%
  9. echo %b%
  10. echo %c%
  11. pause
  12. echo %b%%a%%c%
  13. pause
复制代码

TOP

修改后为:

  1. @echo off
  2. Set str=今日明月在
  3. Set var1=%str:~0,2%
  4. Set var2=%str:~2,2%
  5. Set var3=%str:~4,1%
  6. Echo %var1%
  7. Echo %var2%
  8. Echo %var3%
  9. pause>nul
  10. echo %var2%%var1%%var3%
  11. pause>nul
复制代码

TOP

  1. @echo off
  2. Set str=今日明月在
  3. Set var1=%str:~0,2%
  4. Set var2=%str:~2,2%
  5. Set var3=%str:~4,1%
  6. Echo %var1%
  7. Echo %var2%
  8. Echo %var3%
  9. pause
复制代码

TOP

  1. @echo off
  2. set str=今日明月在
  3. echo %str:~0,2%
  4. echo %str:~2,2%
  5. echo %str:~-1,1%
  6. @echo on
复制代码

TOP

  1. @ echo off
  2. set "str=今日明月在"
  3. set "str1=%str:~2,2%"
  4. set "str2=%str:~0,2%"
  5. set "str3=%str:~4,1%
  6. echo,%str1%%str2%%str3%
  7. pause
复制代码

TOP

  1. @echo off
  2. echo 今日明月在
  3. set a=今日明月在
  4. echo  ``````````````````````````````````````````````````````
  5. echo                           载取后的效果
  6. echo  ``````````````````````````````````````````````````````
  7. echo.&echo.&echo.
  8. echo %a:~0,2%
  9. echo %a:~2,2%
  10. echo %a:~-1%
  11. pause>nul
复制代码

TOP

  1. @echo off
  2. set name=今日明月在
  3. echo %name:~2,2%%name:~0,2%%name:~4,1%
  4. pause>nul
复制代码

TOP

  1. @echo off
  2. set str=今日明月在
  3. echo %str:~0,2%
  4. echo %str:~2,2%
  5. echo %str:~4%
  6. echo %str:~2,2%%str:~0,2%%str:~4%
  7. pause>nul
复制代码

TOP

返回列表