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-24 06:49
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Discussion] ********Question about the Usage of findstr/a******** View 4,428 Replies 22
Floor 16 Posted 2007-11-27 21:05 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
What is the code for 0401 optimized?
Floor 17 Posted 2007-11-27 21:25 ·  中国 北京 鹏博士BGP
银牌会员
★★★
Credits 2,098
Posts 566
Joined 2007-09-11 07:27
18-year member
UID 97070
Gender Male
Status Offline
There are restrictions. It can only convert up to 10 hexadecimal digits (excluding the first two 0s), but it seems to be sufficient.
Floor 18 Posted 2007-11-27 23:53 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Originally posted by s11ss at 2007-11-27 20:51:
Brother zh159, your code for converting multiple digits is no less wordy than mine~~~~~~~~
I'm sorry, I take that back.
Actually, each has its own advantages and disadvantages.
Yours is simple but reduces code readability and increases "program processing volume" (replaces 0-9 all). Mine is wordy but improves code readability.

In terms of "program processing volume", your processing volume should be larger:
call set r=%%r:10=A%%
call set r=%%r:11=B%%
call set r=%%r:12=C%%
call set r=%%r:13=D%%
call set r=%%r:14=E%%
call set r=%%r:15=F%%
call set r%1=%r%%%r%1%%

This part is also a replacement process. Each conversion has to go through six replacements. Data from 0-9 is also processed the same way. It's just that there are no "10-15" numbers in 0-9, so A-F won't be replaced out;
The simplified one I have (the original source should be the version of the moderator Budu Bu Ai) although it reduces code readability, but only needs one-time replacement (actually character interception), which is more efficient

In fact, you can find the same place by just comparing

:10to16
set/a q=%1
:1c
set/a r=%q%%%16
set/a q=%q%/16
call set r=%%r:10=A%%
call set r=%%r:11=B%%
call set r=%%r:12=C%%
call set r=%%r:13=D%%
call set r=%%r:14=E%%
call set r=%%r:15=F%%

call set r%1=%r%%%r%1%%
if not %q% equ 0 goto :1c
call set r=%%r%1%%


:10to16
set H=0123456789ABCDEF
set/a q=%1
:1c
set/a r=%q%%%16
set/a q=%q%/16
call set r=%%H:~%r%,1%%
call set r%1=%r%%%r%1%%
if not %q% equ 0 goto :1c
call set r=%%r%1%%
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
s11ss +2 2007-11-28 13:04
Floor 19 Posted 2007-11-28 00:32 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
iexplore about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>Unable to play Midi, possibly missing VB6 control
Download details: Microsoft Visual Basic 6.0 Common Controls
http://www.microsoft.com/downloads/details.aspx?familyid=25437D98-51D0-41C1-BB14-64662F5F62FE&displaylang=zh-cn
第一高手 第二高手

Floor 20 Posted 2007-11-28 13:03 ·  中国 北京 鹏博士BGP
银牌会员
★★★
Credits 2,098
Posts 566
Joined 2007-09-11 07:27
18-year member
UID 97070
Gender Male
Status Offline
Brother zh159 makes a valid point. I said something wrong again. Indeed, my code is a bit worse. I'll correct it!
Floor 21 Posted 2007-12-02 17:31 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Originally posted by fastslz at 2007-11-28 00:32:
iexplore about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>Cannot play Midi, may be missing VB6 control bar
Download details: Microsoft Visual Bas ...

Not VB library

It is VBA (Visual Basic for Applications) built into Office

vbe6.dll is a dll of the VB editor.

Actually, the easter egg in my signature is also in VB6, the same.

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 22 Posted 2007-12-02 17:57 ·  中国 北京 海淀区 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Hey, is it off-topic?
Floor 23 Posted 2008-06-27 10:45 ·  中国 江西 南昌 电信
初级用户
Credits 48
Posts 19
Joined 2008-04-16 19:57
18-year member
UID 116095
Gender Male
Status Offline
Forum Jump: