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:请访问
批处理编程的异类 ,欢迎交流与共享批处理编程心得!