![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-14 17:22 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS批处理 & 脚本技术(批处理室) » Simulate a funny boot screen with batch processing |
| Printable Version 16,596 / 52 |
| Floor1 bagpipe | Posted 2006-05-15 17:27 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
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 ] Attachments hellokiki.rar (465 bytes) |
|
| Floor2 3742668 | Posted 2006-05-15 19:18 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
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. |
|
| Floor3 doscc | Posted 2006-05-16 08:46 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
I've seen such a signature! It can be made with a batch script.
|
|
| Floor4 bagpipe | Posted 2006-05-16 08:48 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
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!
|
|
| Floor5 bagpipe | Posted 2006-05-16 09:31 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
doscc Since you said it so easily, write one and share it.
|
|
| Floor6 doscc | Posted 2006-05-16 10:47 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
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.
|
|
| Floor7 bagpipe | Posted 2006-05-16 10:52 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
"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!!!!!!!!
|
|
| Floor8 doscc | Posted 2006-05-16 11:00 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
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.
|
|
| Floor9 bagpipe | Posted 2006-05-16 11:06 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
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.
|
|
| Floor10 doscc | Posted 2006-05-16 11:47 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
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. |
|
| Floor11 3742668 | Posted 2006-05-16 13:31 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
```
@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) ``` |
|
| Floor12 3742668 | Posted 2006-05-16 14:37 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
Additionally, regarding the issue of displaying characters sequentially:
For easier reading, the code format is adjusted... [ Last edited by 3742668 on 2006-5-16 at 15:02 ] |
|
| Floor13 bagpipe | Posted 2006-05-16 16:09 |
| 银牌会员 Posts 425 Credits 1,144 From 北京 | |
|
Thanks to brother 3742668's code, I'm studying it earnestly............... I'm extremely admiring....................... Hehe
:》 |
|
| Floor14 doscc | Posted 2006-05-16 16:27 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
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. Also, moderator, why does the following code only display b%% instead of 123? Can variables not be nested? |
|
| Floor15 doscc | Posted 2006-05-16 16:30 |
| 中级用户 Posts 93 Credits 256 From 广东 | |
|
Is it only when the variable uses! as the delimiter that nesting is possible? Like this!Display character:~%%i,1!
|
|
| 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |