bat实现的模仿黑客帝国里面的数码雨
程序员文章站
2022-03-07 21:04:27
::黑客帝国里数码雨 @echo %dbg% off :: code by redtek 2006-11-2&n...
::黑客帝国里数码雨
@echo %dbg% off
:: code by redtek 2006-11-2 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
setlocal enabledelayedexpansion
mode con cols=80 lines=30
cls
set 退格=
set redtek=" "
set end=0
:start
set /a end+=1
call :calc
set /p=!setspaces! nul
set /p=%退格%<nul
set /p=%redtek:~1,79%<nul&echo.
goto :start
:calc
if %end%==28 (
set /a end=0 & cls & set /a cols=!random:~0,2!
echo ... 风力:!cols! ...
if !cols! gtr 76 set cols=76
if !cols! lss 2 set cols=2
set setspaces=!redtek:~1,%cols%!!random:~0,1!
goto :eof
)
@echo off
:: code by jm 2006-11-3 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
:: test.txt内容为:1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz~`!@#%&*(){}[]_+-=\"'?.,/
:: 暂时不能处理 |<>^
mode con cols=80
color 02
for /f %%i in (test.txt) do set str_char=%%i
set str_blank=
setlocal enabledelayedexpansion
:loop
:: 取随机位置上的字符
set /a num_char=1%random:~-1%%random:~0,1%-100
set char=!str_char:~-%num_char%,1!
:: 设置随机长度的空格
set /a num_blank=1%random:~-1%%random:~0,1%-100
set blank=!str_blank:~0,%num_blank%!
echo.%blank%%char%
goto loop
@echo off
:: code by 不得不爱 2006-11-3 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
mode con cols=80
set a=1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz~`!@#%.*(){}[]_+-=\"'?.,/^&^^^>^<
set b=
setlocal enabledelayedexpansion
:a
set /a num=%random%%%92
set 字符=!a:~-%num%,1!
set/a c=%random%%%80
set 空格=!b:~-%c%!
echo %空格%^%字符%
goto a
@echo off
:: code by yfd11 2006-11-3 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
mode con cols=80 lines=30
set a=1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz~`!@#%.*(){}[]_+-=\"'?.,/^&^^^>^<
set b=
setlocal enabledelayedexpansion
:a
set /a num=%random%%%92
set 字符=!a:~-%num%,1!
set/a c=%random%%%80
set 空格=!b:~-%c%!
::echo. %空格%^%字符%
set/a i+=1
rem 指针=i 尾指针=j
set/a j=i-30
set line%i%=%空格%^%字符%
for /l %%v in (%i%,-1,%j%) do echo.!line%%v!
::ping /n 127.1>nul
goto a
@echo off
:: code by hxuan999 2006-11-12 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
::mode con cols=80
setlocal enabledelayedexpansion
color 02
goto begin
goto :eof
::function mt_rand "a" "b"
:mt_rand
::(
set a=%~1
set b=%~2
set /a _mt_rand=(!random!%%(%b%-%a%))+%a%
exit /b 0
::)
:begin
::{--
set iwidth=80
set idensity=6
set stext="#$&'()*+,-./0123456789:;<>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
set stext=!stext:"=!
set /a itext=90-1
for /l %%i in (1,1,%iwidth%) do (
set adown%%i=0
)
:loop
for /l %%i in (1,1,%iwidth%) do (
set /a adown%%i-=1
if !adown%%i! lss 0 (
call :mt_rand "0" "%idensity%"&&set aarrow%%i=!_mt_rand!
call :mt_rand "10" "25"&&set adown%%i=!_mt_rand!
)
if !aarrow%%i! equ 1 (
call :mt_rand "0" "%itext%"&&(for %%m in ("!_mt_rand!") do set aa=!stext:~%%~m,1!)
set /p=!aa!<nul
) else (
set /p= <nul
)
)
goto loop
::--}
:exit
exit /b 0
@echo off
:: code by hxuan999 2006-11-12 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
setlocal enabledelayedexpansion
color 02
for /l %%i in (1,1,80) do (
set down%%i=0
)
:loop
for /l %%j in (1,1,80) do (
set /a down%%j-=1
if !down%%j! lss 0 (
set /a arrow%%j=!random!%%4
set /a down%%j=!random!%%15+10
)
if "!arrow%%j!" == "1" (
set /a chr=!random!%%2
set /p=!chr!<nul
) else (
set /p= <nul
)
)
goto loop
goto :eof
@echo off
:: code by newaifi 2006-11-16 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
setlocal enabledelayedexpansion
for /l %%i in (1,1,80) do (
set down%%i=0
)
for /l %%i in (0) do (
set line=
for /l %%j in (1,1,80) do (
set /a down%%j-=1
call set x=!down%%j!
if !x! lss 0 (
set /a arrow%%j=!random!%%6
set /a down%%j=!random!%%15+10
)
call set x=!arrow%%j!
if "!x!" == "1" (
set line=!line!1
) else (set "line=!line! ")
)
call set /p=!line!<nul
)
@echo %dbg% off
:: code by redtek 2006-11-2 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
setlocal enabledelayedexpansion
mode con cols=80 lines=30
cls
set 退格=
set redtek=" "
set end=0
:start
set /a end+=1
call :calc
set /p=!setspaces! nul
set /p=%退格%<nul
set /p=%redtek:~1,79%<nul&echo.
goto :start
:calc
if %end%==28 (
set /a end=0 & cls & set /a cols=!random:~0,2!
echo ... 风力:!cols! ...
if !cols! gtr 76 set cols=76
if !cols! lss 2 set cols=2
set setspaces=!redtek:~1,%cols%!!random:~0,1!
goto :eof
)
@echo off
:: code by jm 2006-11-3 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
:: test.txt内容为:1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz~`!@#%&*(){}[]_+-=\"'?.,/
:: 暂时不能处理 |<>^
mode con cols=80
color 02
for /f %%i in (test.txt) do set str_char=%%i
set str_blank=
setlocal enabledelayedexpansion
:loop
:: 取随机位置上的字符
set /a num_char=1%random:~-1%%random:~0,1%-100
set char=!str_char:~-%num_char%,1!
:: 设置随机长度的空格
set /a num_blank=1%random:~-1%%random:~0,1%-100
set blank=!str_blank:~0,%num_blank%!
echo.%blank%%char%
goto loop
@echo off
:: code by 不得不爱 2006-11-3 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
mode con cols=80
set a=1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz~`!@#%.*(){}[]_+-=\"'?.,/^&^^^>^<
set b=
setlocal enabledelayedexpansion
:a
set /a num=%random%%%92
set 字符=!a:~-%num%,1!
set/a c=%random%%%80
set 空格=!b:~-%c%!
echo %空格%^%字符%
goto a
@echo off
:: code by yfd11 2006-11-3 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
mode con cols=80 lines=30
set a=1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz~`!@#%.*(){}[]_+-=\"'?.,/^&^^^>^<
set b=
setlocal enabledelayedexpansion
:a
set /a num=%random%%%92
set 字符=!a:~-%num%,1!
set/a c=%random%%%80
set 空格=!b:~-%c%!
::echo. %空格%^%字符%
set/a i+=1
rem 指针=i 尾指针=j
set/a j=i-30
set line%i%=%空格%^%字符%
for /l %%v in (%i%,-1,%j%) do echo.!line%%v!
::ping /n 127.1>nul
goto a
@echo off
:: code by hxuan999 2006-11-12 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
::mode con cols=80
setlocal enabledelayedexpansion
color 02
goto begin
goto :eof
::function mt_rand "a" "b"
:mt_rand
::(
set a=%~1
set b=%~2
set /a _mt_rand=(!random!%%(%b%-%a%))+%a%
exit /b 0
::)
:begin
::{--
set iwidth=80
set idensity=6
set stext="#$&'()*+,-./0123456789:;<>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
set stext=!stext:"=!
set /a itext=90-1
for /l %%i in (1,1,%iwidth%) do (
set adown%%i=0
)
:loop
for /l %%i in (1,1,%iwidth%) do (
set /a adown%%i-=1
if !adown%%i! lss 0 (
call :mt_rand "0" "%idensity%"&&set aarrow%%i=!_mt_rand!
call :mt_rand "10" "25"&&set adown%%i=!_mt_rand!
)
if !aarrow%%i! equ 1 (
call :mt_rand "0" "%itext%"&&(for %%m in ("!_mt_rand!") do set aa=!stext:~%%~m,1!)
set /p=!aa!<nul
) else (
set /p= <nul
)
)
goto loop
::--}
:exit
exit /b 0
@echo off
:: code by hxuan999 2006-11-12 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
setlocal enabledelayedexpansion
color 02
for /l %%i in (1,1,80) do (
set down%%i=0
)
:loop
for /l %%j in (1,1,80) do (
set /a down%%j-=1
if !down%%j! lss 0 (
set /a arrow%%j=!random!%%4
set /a down%%j=!random!%%15+10
)
if "!arrow%%j!" == "1" (
set /a chr=!random!%%2
set /p=!chr!<nul
) else (
set /p= <nul
)
)
goto loop
goto :eof
@echo off
:: code by newaifi 2006-11-16 cmd@xp
:: 出处:http://www.cn-dos.net/forum/viewthread.php?tid=24418
setlocal enabledelayedexpansion
for /l %%i in (1,1,80) do (
set down%%i=0
)
for /l %%i in (0) do (
set line=
for /l %%j in (1,1,80) do (
set /a down%%j-=1
call set x=!down%%j!
if !x! lss 0 (
set /a arrow%%j=!random!%%6
set /a down%%j=!random!%%15+10
)
call set x=!arrow%%j!
if "!x!" == "1" (
set line=!line!1
) else (set "line=!line! ")
)
call set /p=!line!<nul
)
上一篇: XCOPY只拷贝当天文件的实现代码
下一篇: 在DOS方式下对注册表进行操作的代码