中国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-13 03:49
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » A newbie question: about Set
Printable Version  695 / 2
Floor1 crazyclay Posted 2003-10-16 00:00
初级用户 Posts 1 Credits 103
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.
Floor2 sunny1979 Posted 2003-10-16 00:00
初级用户 Posts 86 Credits 376
Yes, it can. These are executed separately, in order!
Floor3 willsort Posted 2003-10-17 00:00
元老会员 Posts 1,512 Credits 4,432
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.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023