China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-22 18:47
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Simulate a funny boot screen with batch processing View 15,545 Replies 52
Original Poster Posted 2006-05-15 17:27 ·  中国 北京 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
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, Credits to download 1 pts, Downloads: 272)
Floor 2 Posted 2006-05-15 19:18 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
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.
Floor 3 Posted 2006-05-16 08:46 ·  中国 上海 华为云
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
I've seen such a signature! It can be made with a batch script.
Floor 4 Posted 2006-05-16 08:48 ·  中国 北京 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
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!
Floor 5 Posted 2006-05-16 09:31 ·  中国 北京 顺义区 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
doscc Since you said it so easily, write one and share it.
Floor 6 Posted 2006-05-16 10:47 ·  中国 上海 华为云
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
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
Floor 7 Posted 2006-05-16 10:52 ·  中国 北京 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
"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!!!!!!!!
Floor 8 Posted 2006-05-16 11:00 ·  中国 上海 华为云
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
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.
Floor 9 Posted 2006-05-16 11:06 ·  中国 北京 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
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.
Floor 10 Posted 2006-05-16 11:47 ·  中国 上海 华为云
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
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
Floor 11 Posted 2006-05-16 13:31 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
```
@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)
```
Floor 12 Posted 2006-05-16 14:37 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
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 ]
Floor 13 Posted 2006-05-16 16:09 ·  中国 北京 联通
银牌会员
★★★
DOS联盟捡破烂的
Credits 1,144
Posts 425
Joined 2005-10-20 00:00
20-year member
UID 43784
From 北京
Status Offline
Thanks to brother 3742668's code, I'm studying it earnestly............... I'm extremely admiring....................... Hehe

:》
Floor 14 Posted 2006-05-16 16:27 ·  中国 上海 华为云
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
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%%
Floor 15 Posted 2006-05-16 16:30 ·  中国 上海 华为云
中级用户
★★
Credits 256
Posts 93
Joined 2006-03-26 22:12
20-year member
UID 52853
Gender Male
From 广东
Status Offline
Is it only when the variable uses! as the delimiter that nesting is possible? Like this!Display character:~%%i,1!
Forum Jump: