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-08-15 10:36
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Help] Please tell me the usage of [] and $ in bat View 2,217 Replies 4
Original Poster Posted 2005-04-14 00:00 ·  中国 湖北 武汉 电信
初级用户
ProGamer
Credits 129
Posts 23
Joined 2005-04-14 00:00
21-year member
UID 38147
Gender Male
Status Offline
Often see the sentence `if == goto %2` written at the beginning of a batch script. What does it mean? What does `$` represent?
I'm a progamer who work with windos
not a programmer with windows
Floor 2 Posted 2005-04-14 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 foxandmonkey: "Often"?! Only my program would have such a usage. If you had read all the programs I wrote here, you wouldn't have this question. This statement is mainly to assist in achieving the modularization you mentioned, similar to the CALL :lable usage under the NT command line. It means that if the first parameter is $, then the second parameter is taken as the label of the specified module and jumps to there. is similar to "%1", I call it "air defense character" because it is to prevent %1 from being empty and causing a syntax error in the if statement. Also, $ and are quasi-keywords often used in my early programs. They are defined by us program designers. Of course, for the uniformity of style and readability of the program, such usage has become my habit. However, now I am considering making some changes in style, such as changing to "" which is used more commonly by more people, and $ to : and so on, because my programming platform has changed a lot.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 3 Posted 2005-04-14 00:00 ·  中国 湖北 武汉 电信
初级用户
ProGamer
Credits 129
Posts 23
Joined 2005-04-14 00:00
21-year member
UID 38147
Gender Male
Status Offline
Brother willsort, PFPF.
I've collected all your programs. Since I came to the forum yesterday, I've been reading them. Good programs are as enjoyable to read as good articles, bringing a feeling of great satisfaction.
In the past, I only dabbled in writing bat files, never a systematic one. Yours are several versions, each improved and full of highlights, making me clap in admiration, ponder deeply, and even forget about food
I'm a progamer who work with windos
not a programmer with windows
Floor 4 Posted 2005-04-24 00:00 ·  中国 山东 济宁 电信
中级用户
★★★
痴迷DOS者
Credits 456
Posts 570
Joined 2004-10-09 00:00
21-year member
UID 32281
Gender Male
Status Offline
WillSoft you... ah
DOS不是万能的,没有DOS是万万不能的
自古系统谁无死?留取胆清照汗青!uploadImages/20035317345478982.png
Floor 5 Posted 2010-11-13 18:04 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 59
Posts 28
Joined 2010-11-05 01:45
15-year member
UID 177110
Gender Male
Status Offline
Thank you for lighting torches for people in the dark!
Forum Jump: