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 02:40
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to represent a progress status with "\-/"? DigestI View 24,460 Replies 57
Original Poster Posted 2006-10-30 15:40 ·  中国 上海 华为云
初级用户
Credits 32
Posts 9
Joined 2006-10-30 15:04
19-year member
UID 68888
Gender Male
Status Offline
In batch processing, you want to use "\-/" to represent a progress status, as if the "-" is rolling. How to achieve this?
Floor 2 Posted 2006-10-30 20:43 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 3 Posted 2006-10-30 21:55 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
@echo off
set str=\-/-
setlocal enabledelayedexpansion
:test
for /l %%i in (-1 1 3) do (
set /p=!str:~%%i,1!<nul
ping /n 2 127.1>nul)
cls
goto :test
pause>nul

Can this code complete the task? If the delay of ping /n 2 127.1 is too long (about 2 seconds), please use other methods.
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
redtek +2 2006-10-30 22:06
haiou327 +1 2007-05-12 16:58
sunxh +1 2009-09-12 12:50
Floor 4 Posted 2006-10-30 22:06 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
It's very similar to the processing of early compression software, wonderful~:) Add points to youxi01~:)
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
qiuqiansuo +1 2007-02-01 00:58
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 5 Posted 2006-10-30 22:26 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
I'll also do one:
@echo off
setlocal enabledelayedexpansion
set b=\-/-
:b
for /l %%i in (0,1,32) do call :a %%i
cls
goto :b
:a
set/a a=%1%%4
set/p=!b:~%a%,1!<nul
ping/n 2 127.1>nul
goto :eof

Second one:
@echo off
setlocal enabledelayedexpansion
set b=\-/-
:b
for /l %%i in (0,1,3) do (
echo !b:~%%i,1!
ping /n 2 127.1>nul
cls)
goto b


[ Last edited by qwe1234567 on 2006-10-30 at 10:34 PM ]
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
redtek +4 2006-10-31 02:38
sunxh +1 2009-09-12 12:51
Floor 6 Posted 2006-10-30 22:39 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Originally posted by 9527 at 2006-10-30 22:23:
I don't think the original poster meant that. Don't you see that the three symbols /\- combine to form an asterisk? It's estimated that the effect he wants is a rotating effect. If it's a rotating effect, Photoshop processing can't achieve it...


So the original poster wanted a fun animation~ : )
The rotating effect can still be achieved. I think there's nothing that can't be done : )
Not only rotation, but also word processing, inserting characters, modifying... : ) (Need to use ASCII code special control characters : )

Added a backspace function based on the code of moderator qwe1234567兄~ : )



====================== Note: Please don't directly use the method of COPY CON filename.bat to COPY,
====================== Because the following code has special control characters, direct copy won't copy properly.
====================== Simple method: COPY to Windows Notepad, then save as a batch file, then execute.

@echo off
rem qwe1234567 character animation

setlocal enabledelayedexpansion
set b=\-/-
set 速度=2

rem ASCII code 08 is the backspace special control character
set 退格=


:b
for /l %%i in (0,1,200) do call :a %%i
goto :b
:a
set/a a=%1%%4
set/p=!b:~%a%,1!<nul
ping/n %速度% 127.1>nul
set/p=%退格%<nul
goto :eof


"The rotating effect can't be achieved with P processing", it's achieved, hehehe...

[ Last edited by redtek on 2006-10-30 at 10:58 PM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
无奈何 +4 2006-10-31 00:17
xycoordinate +1 2007-03-03 04:28
Eblis +2 2007-03-03 06:02
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 7 Posted 2006-10-30 22:48 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
You must not have tried it; it's definitely an effect of spinning (in place)!

LZ: "In batch processing, I want to use "\-/" to represent a progress status, it seems like the "-" is rolling", absolutely this kind of effect:)

After each character is displayed, it moves back one space, and then displays again,
(many command-line software prompts are based on this principle!)
In this way, due to the speed and the visual difference of people, an animation effect (similar to spinning) will be produced,
the same as the processing effect animation of early compression software.

[ Last edited by redtek on 2006-10-30 at 10:51 PM ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 8 Posted 2006-10-30 22:54 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Wait, I copied the code wrong, there are several here, I got confused, but the spin effect really works, wait a minute.
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 9 Posted 2006-10-30 22:56 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Wait,...... I looked again, it's not that I copied wrong!

You must have directly used COPY CON filename.bat in the CMD SHELL to copy the above code,!

So, the "backspace" there = what I put later is the special control character for backspace,
So, when you copy, it actually generates the backspace key, and the backspace symbol here you can't copy.


(You directly copy to Notepad and then save it, it's fine!)
(Originally, when copying the above content directly with copy con filename.bat, the system translated that backspace character as really backspacing by two spaces, causing the variable assignment statement to be incomplete)

Apologize to 9527, it was originally this reason, haha......

[ Last edited by redtek on 2006-10-30 at 11:08 PM ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 10 Posted 2006-10-30 23:00 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
Direct download, batch animation code for rotating in place.
Attachments
q.rar (295 bytes, Credits to download 1 pts, Downloads: 310)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 11 Posted 2006-10-31 00:37 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
Brother, I'm not very smart. Can you tell me:

rem The ASCII code 08 is the backspace special control character
set 退格=

How is the backspace obtained here?
Floor 12 Posted 2006-10-31 01:15 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
) First method:

Using the ECIT.COM editor built into MS-DOS (also available in WINDOWS CMD SHELL) to enter special control characters.

Enter EDIT.COM, press the CTRL+P combination key, and then you can enter special characters:
For example: The ASCII code of the backspace key (to move the cursor to the left) is 08,
Then you can press ALT+08 (hold down the ALT key, then press the 0 and 8 keys on the right small keyboard, release the ALT key after both are entered.
Note: CTRL+P is only effective once. If you enter the second control character, you have to press CTRL+P again


) Second method: Get it with Debug

-D

0AF5:0100 20 20 20 20 20 0D 0A 20-20 20 20 0D 0A BA 8C 8A . .. .....
0AF5:0110 73 03 E9 4E FF 2B C8 74-D0 F6 06 15 34 00 E4 0A s..N.+.t....4...
0AF5:0120 F6 06 15 99 20 75 0A 80-3E D2 99 00 75 BB 49 74 .... u..>...u.It
0AF5:0130 B8 BA 0D 8C EB 23 33 D2-87 D1 B8 01 42 CD 21 A3 .....#3.....B.!.
0AF5:0140 DF 99 89 16 E1 99 80 3E-C5 96 00 74 9C B4 40 CD .......>...t..@.
0AF5:0150 21 72 5F C6 06 E3 99 1A-C3 E8 FF 0F FE 06 D2 96 !r_.............
0AF5:0160 80 3E D1 96 00 74 48 8B-1E 13 99 83 FB 00 7E 33 .>...tH.......~3
0AF5:0170 8B 0E E1 99 8B 16 DF 99-8B C1 0B C2 74 21 B8 00 ............t!..
-E 100

0AF5:0100 20.08

-W

Writing 0000D bytes
-Q



) For special control characters like backspace, if you enter ALT+08 directly on the command line, it will "execute" immediately, which is equivalent to you pressing the backspace and deleting the content on the left.

So, it is more convenient to enter it indirectly in edit.com or other ways.

) For 07 (ringing bell), you can enter GTRL+G or ALT+07 on the command line.

) For other control characters, refer to the ASCII code table
Refer to the following post for more detailed content...

DOS Learning Introduction & Wonderful Articles (Teaching Room) » ASCII Code Table and Meaning
http://www.cn-dos.net/forum/viewthread.php?tid=1641&fpage=1&highlight=ascii%E7%A0%81


[ Last edited by redtek on 2006-10-31 at 01:30 AM ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 13 Posted 2006-10-31 01:24 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
Many thanks
Floor 14 Posted 2006-10-31 01:33 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
3, Use VBS:


createobject("scripting.filesystemobject").opentextfile("tmp.txt",2,true).write chr(8)

Regarding the problem of this topic, actually, it was mentioned in an early reprinted post in this section ("In-depth Exploration of Windows Script Technology"). Now it seems that relatively few friends have understood it.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
redtek +2 2006-10-31 02:38
Floor 15 Posted 2006-10-31 01:49 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
ASCII code tables and related content are detailed in the following posts ~:)

ASCII Code Table and Its Meaning
http://www.cn-dos.net/forum/viewthread.php?tid=1641&fpage=1&highlight=ascii%E7%A0%81


ASCII Encoding Table
http://www.cn-dos.net/forum/viewthread.php?tid=18942&fpage=1&highlight=ASCII


Viewing ASCII Code Star Wars in DOS Interface
http://www.cn-dos.net/forum/viewthread.php?tid=23874&fpage=1&highlight=ASCII

Brief Analysis of Helpless Signature Code
http://www.cn-dos.net/forum/viewthread.php?tid=18838&fpage=1&highlight=%E6%97%A0%E5%A5%88%E4%BD%95



Posts related to ASCII code and more advanced posts about ANSI animations, drawings, and defining keyboards are as follows:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Use of ANSI.SYS Program
http://www.cn-dos.net/forum/viewthread.php?tid=1272&fpage=1&highlight=ANSI


Achieve Color Screen Display Effects Without ANSI Driver in CONFIG
http://www.cn-dos.net/forum/viewthread.php?tid=22025&fpage=1&highlight=ANSI


RAR Supports ANSI Escape Characters
http://www.cn-dos.net/forum/viewthread.php?tid=21800&fpage=1&highlight=ANSI
(As above: RAR supports ANSI escape characters)
(   Can make personalized copyrights of your own website's RAR compressed packages and content declarations, etc.)
(   Can indirectly use this built-in feature of RAR to simply learn ANSI - in an environment without pure DOS)
(   Can indirectly draw favorite images, etc.)

(   For content about ANSI drawing, many tools can be retrieved on gOOGLE.com)
(   At the same time, tools for converting BMP image files to ANSI character maps can also be retrieved...)

[ Last edited by redtek on 2006-10-31 at 05:29 AM ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Forum Jump: