中国DOS联盟论坛

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-08-10 16:54
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Original][BAT] Text Traversal and File Traversal Code in DOS (6 Pieces)
Printable Version  15,693 / 23
Floor1 willsort Posted 2004-02-11 00:00
元老会员 Posts 1,512 Credits 4,432


[ Last edited by willsort on 2006-7-29 at 20:51 ]
Floor2 willsort Posted 2004-02-11 00:00
元老会员 Posts 1,512 Credits 4,432


[ Last edited by willsort on 2006-7-29 at 20:46 ]
Floor3 willsort Posted 2004-02-11 00:00
元老会员 Posts 1,512 Credits 4,432


[ Last edited by willsort on 2006-7-29 at 20:47 ]
Floor4 Kinglion Posted 2004-02-12 00:00
铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室
The original poster is truly a batch processing expert. Admiration! Admiration!
Floor5 willsort Posted 2004-02-26 00:00
元老会员 Posts 1,512 Credits 4,432





[ Last edited by willsort on 2006-7-29 at 20:47 ]
Floor6 笑傲江湖 Posted 2004-02-26 00:00
初级用户 Posts 61 Credits 271
Question:
if exist filelist.txt if exist xset.asd goto loop
set info=%1
set base=%2
What does it mean? Where can I find materials about batch file operations?
Floor7 willsort Posted 2004-02-27 00:00
元老会员 Posts 1,512 Credits 4,432
Re 笑傲江湖:

if exist filelist.txt if exist xset.asd goto loop
rem If both filelist.txt and xset.asd exist, go to loop and start looping

set info=%1
rem Assign the first parameter %1 to the environment variable info

set base=%2
rem Assign the second parameter %2 to the environment variable base

  For materials on batch file operations, the basics can be found in DOS tutorials on the Internet; intermediate and advanced techniques have to be obtained by reading more, modifying more, and writing more. From old computer magazines before 1999, you should be able to find quite a few techniques about batch programming. This site and some DOS forums also often have many classic batch file programs for study and reference. Here is a link for you first.

http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=12&ID=8905



Floor8 龙王 Posted 2004-04-20 00:00
银牌会员 Posts 334 Credits 1,186
A very useful batch file
I learned quite a few techniques from the OP through this thread
But some I understand
And some command lines I don't understand very well
I still need to read it several more times
If everything were explained the way you explained it to 笑傲江湖
It would simply be a classic tutorial and a blessing for newbies
Even so, still thank you so much
Floor9 Kinglion Posted 2004-04-21 00:00
铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室
The address on the 7th floor should now be:
http://dos.e-stone.cn/dosbbs/dispbbs.asp?boardID=12&ID=8905
Everyone is welcome to support the OP.
Floor10 龙王 Posted 2004-04-21 00:00
银牌会员 Posts 334 Credits 1,186
The following is quoted from Kinglion's post on 2004-4-21 16:16:08:
The address on the 7th floor should now be:
http://dos.e-stone.cn/dosbbs/dispbbs.asp?boardID=12&ID=8905
Everyone is welcome to support the OP.

Great
Thanks
Floor11 Climbing Posted 2004-10-15 00:00
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
Re WillSort: I tested the first program in the DOS mode of Windows 20003 and it did not pass, but I basically understood the principle. It extracts the first file through fc, then uses debug to modify the characters before the filename on the first line of setfile.bat to set file=, and then executes that batch file to obtain the needed environment variable. But under 2003 there are these two problems: 1. fc cannot compare a file with the nul device, so another empty file can be used instead. 2. debug cannot correctly modify setfile.bat. I can't find a solution, because I am too unfamiliar with debug.
Floor12 willsort Posted 2004-10-18 00:00
元老会员 Posts 1,512 Credits 4,432


[ Last edited by willsort on 2005-8-14 at 22:44 ]
Floor13 willsort Posted 2004-10-18 00:00
元老会员 Posts 1,512 Credits 4,432


[ Last edited by willsort on 2005-8-14 at 22:48 ]
Floor14 willsort Posted 2004-10-18 00:00
元老会员 Posts 1,512 Credits 4,432
Re Climbing:

  A similar problem occurs under 2000sp4. The second problem is actually also an fc incompatibility problem. When it displays by line
number, there are 8 byte positions before each line of text, rather than the 9 under dos6 and win9x, so solving it is also
very simple: change e 100 'set file=' in the debug script to e 100 'set fil='.


  However, this is just dealing with the matter as it stands. The three batch files mentioned above were only experimental prototypes I used for practice
under dos6.22, and they were made very roughly. Since I officially switched to win98 in March this year, I encountered many
new problems in use, such as the problem of filenames containing spaces, the problem of system/hidden attribute directories; when used under nt,
I also encountered the problem of Chinese filenames; moreover, because too much text stream control was used in the loop body, it led to
seriously low efficiency; in addition, the three programs do not differ much in function or implementation, so there is no need to split them up.

  For all the reasons above, rewriting the above code became necessary. Merging the code, making up for loopholes, improving performance, and writing
documentation produced the so-called V2 edition; actually, not much effort was spent in the process.

  However, one accidental afternoon, on a sudden whim, I thought, why not enhance visit's command-line functions a bit,
such as supporting multiple paths, multiple filters, and multiple file lists. At first I thought it would only require adding a command-line parameter
analysis loop, but when I actually implemented it, I once again experienced the complexity of the command line: redirection output conflicts when if for are nested,
the difference between root directories and subdirectories when determining directories, for's low-grade substitution of filters (win9x/dos), and
one new problem after another came crowding in endlessly. It actually took me a good half a workday before I barely implemented
a rough version. This is the so-called V2CE edition. I do not have much confidence in strict testing.

  Now, looking back at my work, that V2CE edition actually does not have much application value. Multiple
paths and filters can be completely implemented by calling visit multiple times, and in fact, in most cases we only
use one path and one filter; moreover, multi-parameter control brings a decline in ease of use. Users always have a certain psychological barrier toward
programs with many parameters. My personal preference for DOS compression software, from high to low, is rar,zip,arj,
and ease of use is the first consideration; in addition, most importantly, multi-parameter control caused a large increase in code size
and complexity. This program once made me burrow into a ghostly maze built from if for and lose all sense of direction. The readability of the program became
worse and worse, and debugging became more and more difficult, while compatibility pulled in even more tripwires.

  These are the price paid for feature enhancement. Although this is only a relatively extreme example, the importance of the balance between function and
simplicity in program design is obvious from this. An interface with affinity does not mean code with affinity,
and user-friendly requirements do not mean user-friendly implementation. Blindly shifting the complexity on the user's side to the designer (for example
Windows) is not a very smart idea, and the reverse is also true (for example Linux). This is not even considering the dual pressure on both the designer and the user caused by
code feature enhancement.

  “complex makes simple”, indeed!


[ Last edited by willsort on 2005-8-14 at 22:53 ]
Floor15 hq1966 Posted 2005-12-04 22:19
新手上路 Posts 1 Credits 2 From hn
  Really impressive. I'll save it and study it carefully.
  Thank you, moderator willsort.
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023