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-13 02:50
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » A newbie question: about Set View 694 Replies 2
Original Poster Posted 2003-10-16 00:00 ·  中国 北京 联通
初级用户
Credits 103
Posts 1
Joined 2003-10-16 00:00
22-year member
UID 11362
Gender Male
Status Offline
set PATH=f:\j2sdk1.4.2\bin;f:\windows;f:\windows\command
set classpath=.;f:\j2sdk1.4.2\lib\tools.jar

How should the two lines above be understood? Can path be set to any number of paths? Like in the first line above, where three paths are set.
Floor 2 Posted 2003-10-16 00:00 ·  中国 陕西 西安 长安区 电信
初级用户
★★
忍者
Credits 376
Posts 86
Joined 2003-10-16 00:00
22-year member
UID 11361
Gender Male
Status Offline
Yes, it can. These are executed separately, in order!
以C语言软件开发为主:http://sunny1979.icpcn.com
Floor 3 Posted 2003-10-17 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 crazyclay:

set is used to set environment variables, and path is one kind of environment variable. Multiple paths are actually still just one variable value as far as set is concerned (that is, just a string containing semicolons). path is specifically for setting the search path, but neither of them checks whether the path is valid. Finally, the internal command set can completely replace the internal command path.

Usage of set: set variable_name=variable_value
set path=C:\windows;C:\windows\command
set temp=C:\temp

Usage of path: path path
path c:\windows;c:\windows\command
In addition, some people have proposed another so-called correct syntax: path=path; actually, this is just an odd usage caused by command.com's parameter parsing algorithm. It treats = ; and spaces all as valid parameter separators, so
command argv1 argv2
command;argv1;argv2
command=argv1=argv2
The above three usages are all legal and applicable in most cases for internal commands. In the occasional cases where they are not applicable, it is because command.com gives a special interpretation to = or ;, for example in path, ; is used to clear the contents of path.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: