|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
下面是一个按表顺序转换字符串的程序,原文来自本站开发室:
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9250
此程序为批处理中字符串值的顺序转换而编写,一般作为子程序被其他程序调用,也可以将此程序稍做修改,添加入特定批处理程序中作为子模块调用。
@echo off
if == goto %2
if == goto nullargu
:main 主模块: count, match 句参数列表可以根据需要重新设定和增减
set factor=%1
call %0 $ count 1 2 3 4 5 7 8 9
call %0 $ match c d e f g h i j
goto display
:count 计数模块: 根据指定参数 factor 设置变量值 #a1, #a2
if == goto overflow
set #a1=%#a1%-
if not == goto count_2
set #a1=
set #a2=%#a2%+
if == goto overflow
:count_2
if == goto end
shift
goto count
:match 匹配模块: 循环递增变量 #b1, #b2, 若分别与 #a1, #a2 相等, 则指定结果值为当前循环的参数 3.
if == goto overflow
set #b1=%#b1%-
if not == goto match_2
set #b1=
set #b2=%#b2%+
if == goto overflow
:match_2
if == if == set result=%3
if not == goto end
shift
goto match
:display 显示模块: 显示赋值结果
if == echo %factor% convert %result%
set result=
set factor=
set error=
set #a1=
set #a2=
set #b1=
set #b2=
goto end
:nullargu
echo.
echo Error: argument 1 not specified.
echo.
goto end
<img src="images/smilies/face-surprise.png" align="absmiddle" border="0">verflow
echo.
echo Error: number is overflow.
set error=overflow
echo.
goto end
:end
Below is a program for converting strings in table order. The original text comes from the development room of this site:
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9250
This program is written for the sequential conversion of string values in batch processing. It is generally called as a subroutine by other programs. It can also be slightly modified and added as a sub-module call in a specific batch processing program.
@echo off
if == goto %2
if == goto nullargu
:main Main module: The parameter lists of count and match can be reset and increased or decreased as needed
set factor=%1
call %0 $ count 1 2 3 4 5 7 8 9
call %0 $ match c d e f g h i j
goto display
:count Counting module: Set variable values #a1, #a2 according to the specified parameter factor
if == goto overflow
set #a1=%#a1%-
if not == goto count_2
set #a1=
set #a2=%#a2%+
if == goto overflow
:count_2
if == goto end
shift
goto count
:match Matching module: Loop to increment variables #b1, #b2. If they are equal to #a1, #a2 respectively, then specify the result value as the current loop parameter 3.
if == goto overflow
set #b1=%#b1%-
if not == goto match_2
set #b1=
set #b2=%#b2%+
if == goto overflow
:match_2
if == if == set result=%3
if not == goto end
shift
goto match
:display Display module: Display the assignment result
if == echo %factor% convert %result%
set result=
set factor=
set error=
set #a1=
set #a2=
set #b1=
set #b2=
goto end
:nullargu
echo.
echo Error: argument 1 not specified.
echo.
goto end
:overflow
echo.
echo Error: number is overflow.
set error=overflow
echo.
goto end
:end
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2004-2-6 00:00 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
下面是一个获取errorlevel值到环境变量的程序,原文来自本站开发室:
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9358
@echo off
set el=0
if errorlevel 1 set el=1
if not errorlevel 2 goto end
:partbydec
for %%h in (1 2) do if errorlevel %%h00 set elh=%%h
if == for %%t in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %elh%%%t0 set elt=%elh%%%t
if == for %%t in (0 1 2 3 4 5) do if errorlevel %elh%%%t0 set elt=%elh%%%t
if not == for %%o in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %elt%%%o set el=%elt%%%o
if == for %%o in (0 1 2 3 4 5) do if errorlevel %elt%%%o set el=%elt%%%o
set elh=
set elt=
:end
if not == echo current errolevel is %el%
Here is the translation:
The following is a program to get the errorlevel value into an environment variable. The original text comes from the development room of this site:
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9358
@echo off
set el=0
if errorlevel 1 set el=1
if not errorlevel 2 goto end
:partbydec
for %%h in (1 2) do if errorlevel %%h00 set elh=%%h
if == for %%t in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %elh%%%t0 set elt=%elh%%%t
if == for %%t in (0 1 2 3 4 5) do if errorlevel %elh%%%t0 set elt=%elh%%%t
if not == for %%o in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %elt%%%o set el=%elt%%%o
if == for %%o in (0 1 2 3 4 5) do if errorlevel %elt%%%o set el=%elt%%%o
set elh=
set elt=
:end
if not == echo current errolevel is %el%
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2004-2-6 00:00 |
|
|
pontiff
初级用户
 
积分 119
发帖 7
注册 2004-5-11
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
Good
很精典的批处理
Good
A very classic batch script
|
|
2004-5-13 00:00 |
|
|
bush
银牌会员
    
积分 2165
发帖 730
注册 2004-4-21
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
楼主对批处理真是情有独钟,我先收下慢慢看,(忍不住先回帖,过两天争取有点收获)
本来我曾打算做一个遍历目录的批处理,但没写出来,后来用C 写,但结果也很笨拙——有些目录会死机。这种东西用DOS本身来完成是最好的了。
The LZ really has a special liking for batch processing. I'll take it first and read it slowly. (Can't help but reply first, and strive to gain something in a few days)
Originally I once planned to make a batch processing that traverses directories, but didn't write it out. Later I used C to write, but the result is also very clumsy - some directories will crash. It's best to complete this kind of thing with DOS itself.
|
|
2004-6-22 00:00 |
|
|
bush
银牌会员
    
积分 2165
发帖 730
注册 2004-4-21
状态 离线
|
|
2004-6-23 00:00 |
|
|
龙王
银牌会员
    
积分 1186
发帖 334
注册 2003-5-30
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
以下是引用zww3008在2004-1-14 15:42:25的发言:
这些都是很精典的批处理程序,很值得初学者学习参考体味,如果不希望贴子灌水的话,那就请版主置顶吧!不要让贴子沉了。
好不容易再次找到
我真幸运~~
为了大家
我顶一把
The following is the statement from zww3008 on 2004-1-14 15:42:25:
These are all very classic batch processing programs, which are very worthy for beginners to learn, refer to and experience. If you don't want the post to be watered down, then please ask the moderator to pin it! Don't let the post sink.
Finally found it again
I'm really lucky~~
For everyone
I'll give it a top
|
|
2004-10-14 00:00 |
|
|
defrag
中级用户
   痴迷DOS者
积分 456
发帖 570
注册 2004-10-9
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
UPING
|

DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png |
|
2005-2-24 00:00 |
|
|
lhz95418005
初级用户
 
积分 106
发帖 3
注册 2005-2-25
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
郁闷我怎么觉得学的东西越多不懂的东西越多啊刚开学本想再玩两天的明天还是去图书管吧
Depressed, why do I feel that the more I learn, the more things I don't understand? I just wanted to play for a few more days at the beginning of school. I'll go to the library tomorrow.
|
|
2005-2-25 00:00 |
|
|
yangfw54
新手上路

积分 10
发帖 3
注册 2005-11-19
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
确实是难得的好教材,再顶上来!
It is indeed a rare and good teaching material, and I'll bring it back to the top again!
|
|
2005-11-20 14:28 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
|
2006-3-30 13:08 |
|
|
kmlxk
初级用户
 
积分 45
发帖 17
注册 2006-9-23
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
O.O这么经典的东西,强得掉渣啊!
O.O Such a classic thing, extremely powerful!
|
|
2006-9-30 09:29 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
忍不住在顶一下,怀念willsort
Can't help but top it again, miss willsort
|

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'>" |
|
2006-9-30 11:31 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
是啊,很久不见willsort兄的精彩“演讲”了,怀恋……
Yeah, it's been a long time since I saw Brother willsort's wonderful "lecture", miss it...
|
|
2006-10-20 03:06 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
这么精彩的帖子怎么能让它沉下去~:)
欣赏~:)
How can such a wonderful post be allowed to sink ~:)
Appreciation ~:)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2007-2-8 07:09 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
|
2007-2-8 08:40 |
|