中国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 01:46
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » How can I switch from the current directory to an unknown directory?
Printable Version  952 / 11
Floor1 xiaojun Posted 2003-09-28 00:00
银牌会员 Posts 499 Credits 2,202
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。。。。。






Floor2 Wengier Posted 2003-09-28 00:00
系统支持 Posts 10,521 Credits 27,736
Try FPATH with the /S parameter.
Floor3 xiaojun Posted 2003-09-28 00:00
银牌会员 Posts 499 Credits 2,202
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

















Floor4 xiaojun Posted 2003-09-29 00:00
银牌会员 Posts 499 Credits 2,202
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啊?








Floor5 Wengier Posted 2003-10-01 00:00
系统支持 Posts 10,521 Credits 27,736
It should be like this:
FPATH X.EXE /S
and not use the DIR command.
Floor6 xiaojun Posted 2003-10-01 00:00
银牌会员 Posts 499 Credits 2,202
Floor7 Wengier Posted 2003-10-01 00:00
系统支持 Posts 10,521 Credits 27,736
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.
Floor8 xiaojun Posted 2003-10-01 00:00
银牌会员 Posts 499 Credits 2,202
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?... ^_^


Floor9 Wengier Posted 2003-10-01 00:00
系统支持 Posts 10,521 Credits 27,736
Try this:
LOCATE X.EXE /G /N /F1
Floor10 xiaojun Posted 2003-10-01 00:00
银牌会员 Posts 499 Credits 2,202
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



Floor11 Wengier Posted 2003-10-01 00:00
系统支持 Posts 10,521 Credits 27,736
It is:
LOCATE X.EXE /G /N /F1
not:
FPATH LOCATE X.EXE /G /N /F1
Floor12 xiaojun Posted 2003-10-01 00:00
银牌会员 Posts 499 Credits 2,202
....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...:)




















[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023