|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『楼 主』:
用批处理模拟搞笑开机画面
使用 LLM 解释/回答一下
这个是我从网上看到很多人用这个作为自己的签名图片,我想大家也许也看到过,我想想,编写成批处理也不是不可能,不过最后一步没有实现,有兴趣的还请大家一起来研究,下面是代码和文件........
@echo off
cls
echo Microsoft Windows 2000
echo (C) 版权所有 1985-2000 Microsoft Corp.
echo;
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="开"<nul&ping -n 2 127.1>nul&set/p="机"<nul&ping -n 2 127.1>nul&echo;
echo '开机' 不是内部或外部命令,也不是可运行的程序
echo 或批处理文件。
echo.
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="快"<nul&ping -n 2 127.1>nul&set/p="开"<nul&ping -n 2 127.1>nul&set/p="机"<nul&ping -n 2 127.1>nul&echo;
echo '快开机' 不是内部或外部命令,也不是可运行的程序
echo 或批处理文件
echo:
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="他"<nul&ping -n 2 127.1>nul&set/p="妈"<nul&ping -n 2 127.1>nul&set/p="的"<nul&ping -n 2 127.1>nul&set/p="开"<nul&ping -n 2 127.1>nul&set/p="机"<nul&ping -n 2 127.1>nul&echo;
echo '他妈的开机' 不是内部或外部命令,也不是可运行的程序
echo 或批处理文件
echo;
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="你"<nul&ping -n 2 127.1>nul&set/p="他"<nul&ping -n 2 127.1>nul&set/p="妈"<nul&ping -n 2 127.1>nul&set/p="的"<nul&ping -n 2 127.1>nul&set/p="快"<nul&ping -n 2 127.1>nul&set/p="开"<nul&ping -n 2 127.1>nul&set/p="机"<nul&ping -n 2 127.1>nul&echo.
echo '你他妈的快开机' 不是内部或外部命令,也不是可运行的程序
echo 或批处理文件
echo;
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="操"<nul&ping -n 2 127.1>nul&set/p="!"<nul&ping -n 1 127.1>nul&set/p="!"<nul&ping -n 2 127.1>nul&set/p="不"<nul&ping -n 2 127.1>nul&set/p="开"<nul&ping -n 2 127.1>nul&set/p="机"<nul&ping -n 2 127.1>nul&set/p="我"<nul&ping -n 2 127.1>nul&set/p="就"<nul&ping -n 2 127.1>nul&set/p="砸"<nul&ping -n 2 127.1>nul&set/p="了"<nul&ping -n 2 127.1>nul&set/p="你"<nul&ping -n 2 127.1>nul&set/p="!"<nul&ping -n 4 127.1>nul&echo.
echo.
echo.
echo Loading Windows 2000...
echo ================================================================================
不过觉得自己写的有些过于烦琐,望高手提供最佳方法来实现........
Last edited by namejm on 2007-2-3 at 06:35 PM ]
This is something I saw many people using as their signature pictures online. I think everyone might have seen it too. I thought about it, and it's not impossible to write a batch script, but the last step wasn't achieved. Those who are interested are welcome to study it together. The following is the code and files........
@echo off
cls
echo Microsoft Windows 2000
echo (C) Copyright 1985-2000 Microsoft Corp.
echo;
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="Start"<nul&ping -n 2 127.1>nul&set/p="up"<nul&ping -n 2 127.1>nul&echo;
echo 'Start up' is not an internal or external command, nor is it a runnable program
or batch file.
echo.
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="Fast"<nul&ping -n 2 127.1>nul&set/p="Start"<nul&ping -n 2 127.1>nul&set/p="up"<nul&ping -n 2 127.1>nul&echo;
echo 'Fast start up' is not an internal or external command, nor is it a runnable program
or batch file
echo:
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="His"<nul&ping -n 2 127.1>nul&set/p="mom"<nul&ping -n 2 127.1>nul&set/p="of"<nul&ping -n 2 127.1>nul&set/p="Start"<nul&ping -n 2 127.1>nul&set/p="up"<nul&ping -n 2 127.1>nul&echo;
echo 'His mom of start up' is not an internal or external command, nor is it a runnable program
or batch file
echo;
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="You"<nul&ping -n 2 127.1>nul&set/p="His"<nul&ping -n 2 127.1>nul&set/p="mom"<nul&ping -n 2 127.1>nul&set/p="of"<nul&ping -n 2 127.1>nul&set/p="Fast"<nul&ping -n 2 127.1>nul&set/p="Start"<nul&ping -n 2 127.1>nul&set/p="up"<nul&ping -n 2 127.1>nul&echo.
echo 'You his mom of fast start up' is not an internal or external command, nor is it a runnable program
or batch file
echo;
set/p=%cd%^><nul&ping -n 2 127.1>nul&set/p="Fuck"<nul&ping -n 2 127.1>nul&set/p="!"<nul&ping -n 1 127.1>nul&set/p="!"<nul&ping -n 2 127.1>nul&set/p="Can't"<nul&ping -n 2 127.1>nul&set/p="start"<nul&ping -n 2 127.1>nul&set/p="up"<nul&ping -n 2 127.1>nul&set/p="I"<nul&ping -n 2 127.1>nul&set/p="will"<nul&ping -n 2 127.1>nul&set/p="smash"<nul&ping -n 2 127.1>nul&set/p="it"<nul&ping -n 2 127.1>nul&set/p="you"<nul&ping -n 2 127.1>nul&set/p="!"<nul&ping -n 4 127.1>nul&echo.
echo.
echo.
echo Loading Windows 2000...
echo ================================================================================
But I think what I wrote is a bit too cumbersome. I hope experts can provide the best way to achieve it........
Last edited by namejm on 2007-2-3 at 06:35 PM ]
附件
1: hellokiki.rar (2006-5-15 17:27, 465 bytes, 下载附件所需积分 1 点
,下载次数: 272)
|
|
2006-5-15 17:27 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
最后的进度条可以尝试用cls+type+echo来解决。
先把屏幕上的输出保存到文件中,然后用一个循环来type那个文件的内容,并echo出进度条出来,在循环的开始部分用cls来清屏。
或者在最后一步调用一个vbs脚本,利用Wscript.StdOut的Write方法完成一个进度条是很容易的。
建议参考一下 无奈何 兄的签名。
The final progress bar can be tried to be solved with cls + type + echo.
First, save the output on the screen to a file, then use a loop to type the content of that file and echo out the progress bar. Clear the screen with cls at the beginning of the loop.
Or it is easy to call a vbs script at the last step and use the Write method of Wscript.StdOut to complete a progress bar.
It is suggested to refer to Brother Wu Nai He's signature.
|
|
2006-5-15 19:18 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
看过那样的签名!.
是可以用 批处理来做一个.
I've seen such a signature! It can be made with a batch script.
|
|
2006-5-16 08:46 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
3742668兄,你好,对于使用无奈何兄的签名代码的方法我也实验过了,在开始我本来就想用无奈何兄的签名代码的方式来编写,不过无奈何兄的代码在写入%cd%时候效果不是很好也没有找到合适的方法解决所以就只能这样写了,对于进度还3742668
兄指点一二!
Brother 3742668, hello. I have also experimented with the method of using Brother Wunaixie's signature code. At the beginning, I originally wanted to use Brother Wunaixie's signature code method to write, but the effect of Brother Wunaixie's code when writing %cd% was not very good and I didn't find a suitable method to solve it, so I could only write it like this. For the progress, please give me some guidance, Brother 3742668!
|
|
2006-5-16 08:48 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
doscc既然你说的这么轻松,写出来一个共享一下
doscc Since you said it so easily, write one and share it.
|
|
2006-5-16 09:31 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
我子细看了 破烂兄的代码.
前面部份兄以经写出来了.
但是我并没有说 得很轻松.请不要误会了.
下面是我写的 最后的进度 可能不是很好.不过兄可以参考一下. 用无奈何兄的代码可能更好吧.
@echo off
set a==
set n=1
:t
cls
echo Loading Windows 2000...
echo %a%
set a=%a%=
set /a n+=1
if %n%==80 goto end
ping 2 172.1>nul
goto t
:end
I carefully looked at the code of Brother PoLan. The previous part Brother has already written. But I didn't say it was very easy. Please don't misunderstand. The following is the final progress I wrote, which may not be very good. But you can refer to it. It might be better to use Brother WuNaiHe's code.
@echo off
set a==
set n=1
:t
cls
echo Loading Windows 2000...
echo %a%
set a=%a%=
set /a n+=1
if %n%==80 goto end
ping 2 172.1>nul
goto t
:end
|
|
2006-5-16 10:47 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
"破烂兄",呵呵,有意思,不过你的代码我测试了一下,我希望的是用">"来逐个代替“="来进行进程的显示,兄的代码好像就是”=“逐步往前推进吧!!!!!!!!
"Brother Lan Po", heh, interesting. But I tested your code. What I want is to use ">" to replace "=" one by one to display the process. It seems your code is just "=" advancing step by step!!!!!!!!
|
|
2006-5-16 10:52 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
呵呵.是 没错 逐步往前推进
用>可能不是很好.>在批处理是有特殊意议的.不过可以用 》来代替 试试
Hehe. That's right. Progress step by step. Using > may not be very good. > has special meaning in batch processing. However, you can try using 》to replace it.
|
|
2006-5-16 11:00 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
NO, NO ,NO,兄好像还没有明白我的意思,我的意思就是用“>"逐步代替"=",就是说“=“符号已经充满整个DOS行,然后用>符号逐步去替代,不是是">"逐步往前走,是代替
NO, NO ,NO, Brother seems not to have understood my meaning. My meaning is to gradually replace "=" with ">", that is, the "=" symbol has filled the entire DOS line, and then use the ">" symbol to gradually replace it, not that ">" gradually moves forward, but replaces.
|
|
2006-5-16 11:06 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
不好意思啊。是我理解错误.
下面是我改过的代码 不过在变量堪套 %b:~%n%% 时出错(我也不知道为什么出错)。如果没有出错就可以实现最后的进度了。
@echo off
set b=================================================================================
set b1=-
set n=1
:t1
cls
set b1=%b1%-
echo Loading Windows 2000...
echo %b1%%b:~%n%%
set /a n+=1
if %n%==80 goto end
ping 2 172.1 >nul
goto t1
:end
I'm sorry. It's my misunderstanding.
The following is the code I have revised, but there is an error when nesting variables %b:~%n%% (I don't know why it's wrong). If there is no error, the final progress can be achieved.
@echo off
set b=================================================================================
set b1=-
set n=1
:t1
cls
set b1=%b1%-
echo Loading Windows 2000...
echo %b1%%b:~%n%%
set /a n+=1
if %n%==80 goto end
ping 2 172.1 >nul
goto t1
:end
|
|
2006-5-16 11:47 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
@echo off
set b==
set /a flag = 1
call :began 80 rem 保存80个等号到变量b中
call :main %flag%
exit
:began rem 初始化b
set b=%b%=
set /a flag = %flag% + 1
if %flag% geq %1 goto :eof
goto began
:main rem 显示
set b=%b:~1%
set a=%a%0
set /a newflag = newflag + 1
cls
for /l %%i in (1,1,20) do @echo.
echo Loading Windows 2000...
echo %a:0=^>%%b%
call :delay 100 rem 数字可以调整显示速度
if %newflag% equ %1 goto :eof
goto main
:delay rem 延时
set /a num=num + 1
if %num% geq %1 (set num=) && goto :eof
goto delay
由于使用的结构是call和goto,所以代码很是臃肿,不过这种代码利于阅读,所以就用的这种机构。
这个脚本其实主要要解决的问题应该是显示字符">"的问题,因为CMD默认是把它当作重定向来使用的,所以直接echo >是会出错的,正确的方法应该是在前面用符号"^"来转义。在批处理中连续赋">"到变量中并在最后用echo显示出来要用到的^符号是惊人的,所以干脆就用了set命令的替换功能,先赋值0到变量a中,然后在显示的时候把0全部替换成^>,并把变量b依次减少一位,这样就实现了模拟进度的显示。
另外值得注意的一点就是在这个模拟显示中延时的问题,如果用ping来实现的话,由于ping在系统内部返回是需要消耗时间 的,所以就算用ping -n 1 -w 1 0.0.0.2 来处理都不能实现要求,在这个脚本中用的是goto延时,考虑到不同机器的时钟频率不尽相同,所以设置了延时过程(暂且叫它过程吧)的参数,如果觉得效果不好的话可以自行修改。(当然,利用wmic的强大功能也可以根据不同CPU的频率来自动调节参数,不过这就不是这个话题的讨论范围了)
```
@echo off
set b==
set /a flag = 1
call :began 80 rem Save 80 equal signs to variable b
call :main %flag%
exit
:began rem Initialize b
set b=%b%=
set /a flag = %flag% + 1
if %flag% geq %1 goto :eof
goto began
:main rem Display
set b=%b:~1%
set a=%a%0
set /a newflag = newflag + 1
cls
for /l %%i in (1,1,20) do @echo.
echo Loading Windows 2000...
echo %a:0=^>%%b%
call :delay 100 rem The number can be adjusted to control the display speed
if %newflag% equ %1 goto :eof
goto main
:delay rem Delay
set /a num=num + 1
if %num% geq %1 (set num=) && goto :eof
goto delay
Since the structure uses call and goto, the code is quite bloated, but such code is easy to read, so this structure is used.
Actually, the main problem that this script should solve is the problem of displaying the character ">", because CMD by default treats it as redirection, so directly echo > will cause an error. The correct method is to use the symbol "^" to escape it in front. In batch processing, continuously assigning ">" to a variable and finally using echo to display it requires an astonishing number of ^ symbols, so I simply used the replacement function of the set command. First, assign 0 to variable a, then when displaying, replace all 0s with ^>, and reduce variable b by one bit in turn, so as to realize the display of the simulated progress.
Another noteworthy point is the issue of delay in this simulated display. If ping is used to implement it, because the internal return of ping consumes time, even if ping -n 1 -w 1 0.0.0.2 is used to handle it, it cannot meet the requirements. In this script, goto delay is used. Considering that the clock frequencies of different machines are not exactly the same, the parameter of the delay process (temporarily called a process) is set. If the effect is not good, you can modify it yourself. (Of course, using the powerful functions of wmic can also automatically adjust the parameters according to the frequency of different CPUs, but this is not the scope of this topic)
```
|
|
2006-5-16 13:31 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
另外关于依次显示字符的问题:
@echo off
call :显示文字 "操,再不开机老子砸了你" 80
goto :eof
:显示文字
setlocal ENABLEDELAYEDEXPANSION
set 显示字符=%1
set 显示速度=%2
if "%2" == "" set 显示速度=100
set 显示速度
for /l %%i in (0,1,1000) do (
if %%i == 0 (
set /p cxs=%cd%^><nul
) else (
echo !显示字符:~%%i,1! | findstr /i "ECHO" >nul 2>nul && goto quit || (
set /p cxs=!显示字符:~%%i,1!<nul
for /l %%j in (1,1,%显示速度%) do @call %%j 2>nul)
)
)
:quit
echo.
endlocal
为了便于阅读,把代码格式改改...
Last edited by 3742668 on 2006-5-16 at 15:02 ]
Additionally, regarding the issue of displaying characters sequentially:
@echo off
call :displayText "Damn, if you don't start the computer soon, I'll smash it" 80
goto :eof
:displayText
setlocal ENABLEDELAYEDEXPANSION
set displayChars=%1
set displaySpeed=%2
if "%2" == "" set displaySpeed=100
set displaySpeed
for /l %%i in (0,1,1000) do (
if %%i == 0 (
set /p cxs=%cd%^><nul
) else (
echo !displayChars:~%%i,1! | findstr /i "ECHO" >nul 2>nul && goto quit || (
set /p cxs=!displayChars:~%%i,1!<nul
for /l %%j in (1,1,%displaySpeed%) do @call %%j 2>nul)
)
)
:quit
echo.
endlocal
For easier reading, the code format is adjusted...
Last edited by 3742668 on 2006-5-16 at 15:02 ]
|
|
2006-5-16 14:37 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
谢谢3742668兄的代码,认真学习中...............无限佩服中 .......................呵呵
:》
Thanks to brother 3742668's code, I'm studying it earnestly............... I'm extremely admiring....................... Hehe
:》
|
|
2006-5-16 16:09 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
谢谢 3742668版主.
下面是我改过后的代码 虽然不是很好不过改一改还是好一点.
我真傻啊 前面用 set b1=%b1%- 来逐步增加 记然想不到用set b=%b:~1%来减少
@echo off
set b================================================================================
set b1=-
set n=1
:t1
cls
set b1=%b1%-
set b=%b:~1%
echo Loading Windows 2000...
echo %b1%%b%
set /a n+=1
if %n%==80 goto end
ping 2 172.1 >nul
goto t1
:end
还有版主 下面代码为什么 只显示 b%%而不是123? 变量不可以堪套吗?
set a=123456789
set b=3
echo %a:~0,%b%%
Thanks, moderator 3742668.
The following is the code I modified. Although it's not great, making some changes is still better.
I'm really stupid. I used set b1=%b1%- to increase step by step earlier, but I didn't think of using set b=%b:~1% to decrease.
@echo off
set b================================================================================
set b1=-
set n=1
:t1
cls
set b1=%b1%-
set b=%b:~1%
echo Loading Windows 2000...
echo %b1%%b%
set /a n+=1
if %n%==80 goto end
ping 2 172.1 >nul
goto t1
:end
Also, moderator, why does the following code only display b%% instead of 123? Can variables not be nested?
set a=123456789
set b=3
echo %a:~0,%b%%
|
|
2006-5-16 16:27 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
是不是变量只能是 以!为扩搌符时 才可以堪套
像这个 !显示字符:~%%i,1!
Is it only when the variable uses! as the delimiter that nesting is possible? Like this!Display character:~%%i,1!
|
|
2006-5-16 16:30 |
|