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 18:10
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » [Newbie Seeking Help] Understanding and Usage of PATH! View 4,463 Replies 24
Original Poster Posted 2005-09-02 08:34 ·  中国 辽宁 鞍山 联通
初级用户
Credits 195
Posts 49
Joined 2005-08-12 12:19
21-year member
UID 41584
Gender Male
From 辽宁
Status Offline
I don't quite understand the PATH command and don't know how to use it well. Please be so kind as to give me your advice. Thanks! It's better to be detailed...
Floor 2 Posted 2005-09-02 19:15 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
21-year member
UID 41046
Gender Male
Status Offline
PATH is a command to specify the search path for programs. For example, if your WPS.com file is placed in C:\UCDOS, and you want to be able to immediately type WPS to start WPS to process text at any time, then you need to tell DOS in advance in which directories the WPS.COM file can be found. Then you should enter PATH C:\UCDOS or SET PATH=C:\UCDOS when the computer starts. Additionally, you can add this command in the AUTOEXEC.BAT file, so you don't need to type it every time you start up.
欢迎造访DOS的小屋!
http://risky.ik8.com
Floor 3 Posted 2005-09-03 10:34 ·  中国 安徽 宿州 泗县 电信
银牌会员
★★★
Credits 1,339
Posts 595
Joined 2004-05-26 00:00
22-year member
UID 25306
Gender Male
From 安徽 宿州
Status Offline
DOS commands are divided into two types: one is internal commands, and the other is external commands. Internal commands are in the essential file Command.com of DOS. External commands are placed on the disk (floppy disk, hard disk or CD - ROM) in the form of files with the same name as the external commands. When you type in a command, DOS first looks for it in Command.com, and executes it after finding it; if it is not found in Command.com, it looks in the current directory; if it is not found in the current directory, it looks in the search path you specified; if it is still not found, it will display "Bad command or file name", which is the most common error prompt message we see under DOS. Under DOS, there are three types of files that can be executed. The extensions of these three types of files are:.com,.exe,.bat. For example, the current directory is A:\, and there is an executable file Tw.exe in A:\hd. Because the current directory is A:\, when you type in Tw (you don't need to type in the extension for DOS commands), DOS first looks for Tw in Command.com to see if it is an internal command. (Of course, it can't be found because Tw is not an internal command). Then it looks for Tw in the current directory (that is, A:\). The current directory is A:\, and there is no Tw in A:\ (Tw is in A:\hd). At this time, if you haven't set the search path of executable files with Path, DOS will display "Bad command or file name". If you use Path = A:\; A:\hd, when DOS doesn't find Tw in the current directory (that is, A:\), it will look for Tw in the search path you specified (in this example, A:\hd). Because you have specified the search path, it will execute Tw and won't display "Bad command or file name". Another example: the current directory is C:\, when you type in Tw, DOS first looks for Tw in Command.com, if not found, it looks for Tw in the current directory (current directory is C:\), if not found, it looks for Tw in the set paths A:\ and A:\hd, if found, it executes it, if not found, it displays "Bad command or file name". In conclusion, the Path command is to set the search path for executable files, so that you can execute commands no matter in which directory (that is, as long as the DOS prompt appears) without having to enter into this directory. And Path itself is an internal command.
Floor 4 Posted 2005-09-05 08:23 ·  中国 辽宁 鞍山 联通
初级用户
Credits 195
Posts 49
Joined 2005-08-12 12:19
21-year member
UID 41584
Gender Male
From 辽宁
Status Offline
Thanks! Learning...
Floor 5 Posted 2006-03-12 15:48 ·  中国 天津 和平区 联通
初级用户
Credits 126
Posts 6
Joined 2003-06-02 00:00
23-year member
UID 2958
Gender Male
Status Offline
Does the PATH command have a limit on the number of paths? What is the maximum number of paths I can set in the PATH command?
Floor 6 Posted 2006-03-12 21:52 ·  中国 山东 济南 移动
钻石会员
★★★★★
Credits 10,056
Posts 3,041
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
I haven't encountered a limit on the number of paths, but there is a limit on the length of paths.
简单就是美
Floor 7 Posted 2006-03-15 20:49 ·  中国 广西 玉林 电信
初级用户
Credits 75
Posts 36
Joined 2006-02-08 20:00
20-year member
UID 50048
Status Offline
Floor 8 Posted 2006-03-16 21:49 ·  中国 湖南 娄底 电信
新手上路
Credits 8
Posts 4
Joined 2006-03-16 20:39
20-year member
UID 52208
Status Offline
The explanation on the third floor is very detailed, I've learned it.
Floor 9 Posted 2006-03-16 21:52 ·  中国 湖南 常德 电信
银牌会员
★★★
Credits 1,384
Posts 709
Joined 2005-10-29 22:22
20-year member
UID 44271
Status Offline
Ask, if you don't want the default path of Windows 98 in autoexec.bat and want to add your own new path, how should you do it?
Floor 10 Posted 2006-03-17 13:03 ·  中国 上海 黄浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
Originally posted by wl00560 at 2006-3-16 21:52:
Ask, if in autoexec.bat, do not want the default path of Windows 98, but want to add their own new path, how should it be done?

The second floor has already answered your question earlier
Floor 11 Posted 2006-03-17 18:15 ·  中国 湖南 常德 电信
银牌会员
★★★
Credits 1,384
Posts 709
Joined 2005-10-29 22:22
20-year member
UID 44271
Status Offline
Originally posted by DOSforever at 2006-3-17 13:03:

The user on the 2nd floor has already answered your question earlier.

No, I mean to cancel the default path, such as c:\windows, etc., and then add my own path.
Floor 12 Posted 2006-03-17 18:24 ·  中国 山东 济南 移动
钻石会员
★★★★★
Credits 10,056
Posts 3,041
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
The newly set path will overwrite the original path settings.
简单就是美
Floor 13 Posted 2006-03-18 15:02 ·  中国 湖南 常德 电信
银牌会员
★★★
Credits 1,384
Posts 709
Joined 2005-10-29 22:22
20-year member
UID 44271
Status Offline
No, the new path will be added after the default path, you can try it yourself. The default path is always there
Floor 14 Posted 2006-03-19 20:04 ·  中国 广东 深圳 福田区 电信
初级用户
★★
Credits 133
Posts 57
Joined 2006-03-15 23:12
20-year member
UID 52128
Status Offline
Floor 15 Posted 2006-03-20 13:39 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
21-year member
UID 41046
Gender Male
Status Offline
Originally posted by wl00560 at 2006-3-18 15:02:
No, the new path will be added after the default path, you can try it yourself. The default path is always there


That might be because you are using DOS under Windows. Windows has its own environment variables. You need to modify it under Windows.
欢迎造访DOS的小屋!
http://risky.ik8.com
Forum Jump: