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-25 08:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to obtain the current path information in batch processing View 16,146 Replies 20
Floor 16 Posted 2005-03-18 00:00 ·  中国 山西 临汾 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re dosforever:

Because of personal reasons I didn't reply to your post in time, and I feel deeply sorry! I agree with everything you said above; in fact there is no contradiction between what you said and what I said. It's just that in my previous reply I didn't express too many opinions on tool usage, but seeing how enthusiastic you and the others were, I took some time out of my busy schedule to add a few more words here, for further discussion:

First, “third party” really is only a concept, a concept created and maintained by the “first-party” software producer. For us users as the “second party,” under normal circumstances it is an insignificant concept. But in certain special circumstances, this concept can be transformed into real influence. For example, Microsoft created MSDOS and became the unquestioned “first party” of this system, while Symantec, JPSoftware and the like have intentionally or unintentionally, half-pushed and half-willingly, become the “third party” of this system. And we as the “second party” can often give up any “third party” at any time, because we can often find better substitutes, but for the “first party” we have already developed an indisputable dependence, because it is very hard for us to find an equivalent replacement.

Second, anyone can use any third-party product, but the premise is that he can obtain that product. You assume by default that 4DOS is a treasure that any DOS fan can easily get, so you have spared no effort in promoting it. But at present, compared with the software products we commonly use (such as DOS and Windows), the ways to obtain it are still much narrower. Quite a lot of DOS users cannot access the Internet or even pirated CDs (perhaps you find that unbelievable; I once studied 4DOS too, but only in books and magazines, because at the time I could not get the software, so in the end I gave up continuing deeper). For them, using first-party products to meet their needs has considerable necessity and inevitability. Also, in machine environments such as boot disks and diskless workstations, first-party products are sometimes an unavoidable choice.

Third, using external commands and even third-party tools in batch files is completely acceptable, but at the same time you need to ensure that it can receive sufficient support in any environment where it may run. To satisfy such support, one way is to package all supporting programs together with your batch file when publishing it; another is to encode external programs into the batch file itself in a MIME-like way. But these methods all make the program too large and cause it to lose the advantages of a batch file. So we can only restrict the runtime environment of the batch file, and sometimes this kind of restriction is fatal.

Fourth, reducing I/O really is necessary, but if it cannot be avoided and will not clearly affect the running of the program, then using it appropriately can also achieve a miraculous effect. In the batch files I write now, I almost can no longer avoid using it; it has already become an exceptionally important part of my batch programming syntax.

Fifth, the usage of %temp%.\ is not a syntax error, but a syntax trick. It is used to be compatible with references to paths with a trailing backslash (such as C:\) and paths without a trailing backslash (such as C:\temp). If %temp% is a root path like C:\, then %temp%.\filename.ext becomes C:\.\filename.ext. Since the current path under the root path is still the root path, it does not affect file referencing, but it prevents the path syntax error of a double “\”. And if %temp% is a directory path like C:\temp, then %temp%.\filename.ext becomes C:\temp.\filename.ext. Since Temp. (a directory name without an extension) is still temp, the file reference is still valid, and it also prevents the path syntax error of not having a “\”.

Finally, let me conclude with your signature to express our common wish!

——“DOS has fallen, but it will never die”


[ Last edited by willsort on 2005-10-30 at 13:58 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
Jneny +8 2009-03-19 23:40
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 17 Posted 2005-03-18 00:00 ·  中国 湖南 娄底 中移铁通
中级用户
★★
Credits 312
Posts 77
Joined 2004-02-09 00:00
22-year member
UID 17031
Gender Male
Status Offline
Not bad, learned something new. I'm a newbie at batch files, I need to study hard.
Floor 18 Posted 2005-08-08 02:45 ·  中国 广东 广州 越秀区 电信
初级用户
★★
Credits 115
Posts 52
Joined 2005-08-07 22:10
20-year member
UID 41435
Gender Male
Status Offline
Expert indeed! My utmost admiration!
愿你们永远开心
Floor 19 Posted 2007-05-04 13:48 ·  中国 重庆 电信
新手上路
Credits 4
Posts 2
Joined 2007-03-21 07:44
19-year member
UID 82432
Gender Male
Status Offline
Impressive, my utmost admiration, a model for me to learn from.
Floor 20 Posted 2007-05-04 20:50 ·  中国 湖南 邵阳 电信
初级用户
Credits 25
Posts 13
Joined 2007-04-10 04:48
19-year member
UID 84568
Gender Male
Status Offline
I'm here to learn.
Floor 21 Posted 2009-11-05 22:02 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,282
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
What a pity, what a pity—there's nothing about detecting hard disk capacity or comparing number sizes!
Forum Jump: