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:48
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » How can I switch from the current directory to an unknown directory? View 954 Replies 11
Original Poster Posted 2003-09-28 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
I use dir in a batch file to find a program, X.EXE, and find that it is in the D:\PROGRA FILE\ABC\DEF directory, while the current directory is C:\ ; in the batch file, what kind of statement should I add so it can automatically switch from C:\ to D:\PROGRA FILE\ABC\DEF ? Or automatically add the found result D:\PROGRA FILE\ABC\DEF to PATH, (I don't know beforehand which drive or which directory it is in)
Thanks。。。。。






一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 2 Posted 2003-09-28 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
Try FPATH with the /S parameter.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 3 Posted 2003-09-28 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
Boss, can it be done with internal commands? Like "for", "if exist", or something else; I output the search result into another bat file and call it in the batch file, but I can't add cd before the output bat file, that is ---- D:\PROGRA FILE\ABC\DEF ; the directory can't be changed, so x.exe in that directory still can't be executed; is there a way to use a statement to add the full directory to "path"?
If it won't work without using a program to change directories, then I'll have to go try that fpath... Thanks

















一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 4 Posted 2003-09-29 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
I already added the path e:\; to path, so why do I still always have to switch the current drive letter to E:\ before it can find this x.exe? Where did I go wrong?

SET PATH=%PATH%;G:\DOS;E:\;
dir x.EXE /s /b /a
FPATH /S
PAUSE

And after it finds it, when it gets to the fpath /s step, it shows: not found ; it still doesn't run啊?








一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 5 Posted 2003-10-01 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
It should be like this:
FPATH X.EXE /S
and not use the DIR command.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 6 Posted 2003-10-01 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 7 Posted 2003-10-01 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
Isn't D:\PROGRA FILE\ABC\DEF in %PATH%? If it isn't, then use the LOCATE command to automatically search the whole disk for X.EXE and set the path.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 8 Posted 2003-10-01 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
Using fpath win.com /s, I can find the directory for win.com; if it's a directory not in path, then it can't find it; looking at fpath /? there is no locate command; how is it used, boss?... ^_^


一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 9 Posted 2003-10-01 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
Try this:
LOCATE X.EXE /G /N /F1
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 10 Posted 2003-10-01 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
I used it like this: fpath LOCATE X.EXE /G /N /F1 and it still says not found. :(

Could it be a problem with my fpath.exe?
FPATH command_name
locates executable file acc. to COMMAND.COM procedures
shows full path and filename
/S selects drive and path (no output)
/P returns path, ending with backslash
is inserted before output
Ver 1.1 (c) 1998, Horst Schaeffer



一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 11 Posted 2003-10-01 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
It is:
LOCATE X.EXE /G /N /F1
not:
FPATH LOCATE X.EXE /G /N /F1
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 12 Posted 2003-10-01 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
....Finally found it, after all that it had been hiding in my drive the whole time, and I hadn't even read the instructions yet ;:)
Solved, many thanks many thanks many thanks moderator...:)




















一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Forum Jump: