电脑爱好者论坛's Archiver

wind09 发表于 2008-6-6 10:14

超个性的逐字输出

超个性的逐字输出














转自 [url]www.verybat.cn[/url]



写了一个极富个性的逐字输出的批处理
它支持两种字符输入
一种是运行后手工输入字符 然后逐字输出
另一种是把文件托进批处理 也会逐字将文本内容输出
而且每40个字符会自动换行..

不过说句实话 这个东西没多大实用性
只是偶尔无聊时玩玩..不错...











@echo off && setlocal enabledelayedexpansion
for %%k in (x0 x1 x2 x3 x4 x5) do (
set /a cn+=1,cc=0
for %%c in (0a 0b 0c 0d 0e 0f) do (
set /a cc+=1
if !cn!==!cc! set %%k=%%c
    )
)
if not "%~1"=="" (
for /f "usebackq delims=" %%1 in (%1) do set content=!content!%%1
call :count
) else (goto windcontent)
:windcontent
set /p content=请输入字符 & cls
:count
set a=0
:add
if not "!content:~%a%,1!"=="" set /a a+=1 && goto :add
set b=./-\
set t=for /l %%a in (1 1 399) do echo.^>nul
for /l %%a in (0 1 %a%) do (
set /p=!content:~%%a,1!<nul
set /a num+=1
if !num!==40 set num=0 && echo.
for %%c in (0 1 2 3) do (
set /a r=!random!%%6 && set r=x!r!
call color %%!r!%%
set /p=!b:~%%c,1!<nul
set /p=<nul
%t%
    )
)
set /p= <nul && echo.
pause>nul

Batcher 发表于 2008-6-8 11:05

是不是有bug啊,既然启用了变量延时扩展,文本里面有感叹号时会出问题吧。

test.txt
[quote]!!!&&&<<<>>>[/quote]

wind09 发表于 2008-6-8 15:47

如果有半角的感叹号 则不会输出
其实最在的bug是如果文本中半角的等号 那么会输出"命令语法不正确"
不过 它还是会继续执行的

Batcher 发表于 2008-6-9 00:21

刚刚到verybat看了一下,楼主就是那里的超版吧?混得不多哦^_^
CN-DOS有段代码用的逐位截取的方法,楼主能否参考一下呢?[code]set /p= !str:~0,1!<nul
[/code]

lycvsandy3000 发表于 2008-6-9 07:39

支持一下
学习学习

zrs661jh 发表于 2008-7-1 09:22

谁是好莱坞最值钱身体?

**** 作者被禁止或删除 内容自动屏蔽 ****

太阳雨花 发表于 2008-7-13 09:07

环风磨粉机

**** 作者被禁止或删除 内容自动屏蔽 ****

hz221zj88 发表于 2008-7-19 17:49

眼部问题大扫除

**** 作者被禁止或删除 内容自动屏蔽 ****

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2007 Comsenz Inc.