最近,本论坛对 批处理 动画"研究"似乎比较热
为跟潮流,也为打发一些不太快乐的时光,作一批处理,以博一笑。
动画效果:字符串向左移动到 最左端,然后右移,到一定程度,再左移...- @echo off %=======关闭回显========%
- Rem '/*程序名称:动画显示示例
- Rem '/*程序说明:实现一段字符从左到右、从右到左的移动效果
- Rem '/*作者:youxi01@bbs.bathome.net
- Rem '/*时间:于2007-12-15
- Rem '/*------开启延迟变量----------
- setlocal enabledelayedexpansion
- for /l %%i in (1 1 5) do echo.
- color 1f
- Rem '/*=======此处字符可以根据需要自行修改========
- set "str=欢迎光临论坛:bbs.bathome.net"
- set "space= "
- call :ShowStr "%space%%str%"
- call :Move_Left "%space%%str%"
- pause>nul
- Rem '/*=========延时"函数"===========
- :Delay_Time num(次数)
- for /l %%i in (0 1 %1) do ver>nul
- goto :eof
- Rem '/*========动画"函数"1(出现效果)========
- :ShowStr str
- title bbs.bathome.net -- 正在载入动画...
- set "Sstr=%~1"
- for /l %%i in (0 1 60) do set /p=!Sstr:~%%i,1!<nul& call :Delay_Time 200
- goto :eof
- Rem '/*========动画函数2(向左移动)==========
- :Move_Left str
- title bbs.bathome.net -- 字符正在往左移...
- set "Lstr=%~1"
- for /l %%i in (0 1 200) do (
- set "Lstr_=!Lstr:~%%i,60!
- if not "!Lstr:~%%i,1!"==" " call :Move_Right %str%
- for /l %%j in (0 1 80) do set /p=<nul
- set /p=!Lstr_!<nul & call :Delay_Time 150)
- Rem '/*========动画函数2(向右移动)==========
- :Move_Right str
- title bbs.bathome.net -- 字符正在往右移...
- set "Rstr=%~1"
- for /l %%i in (0 1 30) do (
- set "Rstr= !Rstr!"
- for /l %%j in (0 1 80) do set /p=<nul
- set /p=!Rstr!<nul & call :Delay_Time 150)
- ping /n 3 127.1>nul
- call :Move_Left "%space%%str%"
复制代码
|