标题: [文本处理] 求助批处理逐字显示字符串的结果为什么带双引号 [打印本页]
作者: 苦涩的回忆 时间: 2012-6-4 16:45 标题: 求助批处理逐字显示字符串的结果为什么带双引号
本帖最后由 pcl_test 于 2016-9-14 00:10 编辑
为什么还字显示有引号
代码如下:
@echo off
title spring-clover
color 0a
mode con: cols=80 lines=22
setlocal enabledelayedexpansion
set "theme=have a relax"
for /l %%a in (1 1 6) do echo.
set /p= <nul
call :string "!theme!"
pause
exit
:string
set string=%1
echo !string!
:str
set word=!string:~0,1!
set string=!string:~1!
set /p=!word!<nul&call :sleep 100
if defined string goto str
goto :eof
:sleep
set Time1=%time%
set/a minute1=1%Time1:~3,2%-100
set/a second1=1%Time1:~6,2%%Time1:~-2%0-100000
oop
set Time2=%time%
set/a minute2=1%Time2:~3,2%-100
set/a second2=1%Time2:~6,2%%Time2:~-2%0-100000
set/a difMs=((%minute2%-%minute1%+60)%%60)*60000+%second2%-%second1%
if %difMs% lss %1 goto Loop
goto :eof
作者: canyuexiaolang 时间: 2012-6-5 12:57
- @echo off
- title spring-clover
- color 0a
- mode con: cols=80 lines=22
- setlocal enabledelayedexpansion
- set "theme=have a relax"
- for /l %%a in (1 1 6) do echo.
- set /p= <nul
- call :string "!theme!"
- pause
- exit
- :string
- set string=%~1
- echo !string!
- :str
- set word=!string:~0,1!
- set string=!string:~1!
- set /p=!word!<nul&call :sleep 100
- if defined string goto str
- goto :eof
-
- :sleep
- set Time1=%time%
- set/a minute1=1%Time1:~3,2%-100
- set/a second1=1%Time1:~6,2%%Time1:~-2%0-100000
- :Loop
- set Time2=%time%
- set/a minute2=1%Time2:~3,2%-100
- set/a second2=1%Time2:~6,2%%Time2:~-2%0-100000
- set/a difMs=((%minute2%-%minute1%+60)%%60)*60000+%second2%-%second1%
- if %difMs% lss %1 goto Loop
- goto :eof
复制代码
管理员呢
作者: canyuexiaolang 时间: 2012-6-5 13:01
- @echo off & title spring-clover & setlocal enabledelayedexpansion
- set "theme=have.a.relax"
- echo %theme%
- for /l %%i in (0 1 11) do (
- set /p=!theme:~%%i,1!
- for /l %%x in (0 1 1000) do ver>nul
- )<nul
- pause>nul
复制代码
效果是这样为嘛这么长
作者: 苦涩的回忆 时间: 2012-6-5 17:42
我那里没有逗号,之所以这么长,我们使用的方法不一样,特别是逐显,我那个可以不限字符数量。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |