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-12 22:21
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Question about a command to find a hard disk and run a program: View 1,059 Replies 5
Original Poster Posted 2003-08-30 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
Question: In a batch file, how should the command be written if I want to find the hard disk, or find out how many partitions the hard disk has?
What I mean is, I added something to the boot disk batch file to look on the hard disk for a program; if it finds it, it stops and runs it. But this program on the hard disk is not under C:\ or D:\, it is in C:\..\..\ , several directory levels deep. After I boot with the boot disk, I want it to first find the hard disk, then find the partitions, then starting from C, search all the way to the last partition; if it finds it, run it; no matter how deep in the directories it is. I really can't write out the complete command for this;
Please help, thanks!


一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 2 Posted 2003-08-30 00:00 ·  中国 湖北 武汉 联通
银牌会员
★★★
Credits 1,681
Posts 512
Joined 2003-08-02 00:00
23-year member
UID 7953
Gender Male
Status Offline
Is the filename fixed?
Somehow somewhere I've got to choose.
No matter if it is win or lose.
Floor 3 Posted 2003-08-30 00:00 ·  中国 湖北 武汉 联通
银牌会员
★★★
Credits 1,681
Posts 512
Joined 2003-08-02 00:00
23-year member
UID 7953
Gender Male
Status Offline
dir c:\win.com /s/b/a | command
Then it can search for win.com on c:\, and if it finds it, execute it
Somehow somewhere I've got to choose.
No matter if it is win or lose.
Floor 4 Posted 2003-08-31 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
It is fixed, OK, thank you; I'll go try it; sorry, there's still one question left: what command should I use to find the hard disk and then find out how many partitions it has and their sizes, and display the results on the screen?
一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 5 Posted 2003-08-31 00:00 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,202
Posts 499
Joined 2003-06-12 00:00
23-year member
UID 4876
Gender Male
Status Offline
I tried it with kvd2003, and the program ran, but it couldn't return to DOS; after pressing Esc to exit, it loaded kvd again, then after pressing Esc again to exit, there was just a c:\>_ at the bottom with the cursor blinking, but the keyboard could not accept input; the commands after that in the batch file, like clearing the screen, were not executed either. Other programs are the same too, how could this happen?


一年四季,枫叶红了又红;人生四季,失去的,还能再来吗?—— !
Floor 6 Posted 2003-09-05 00:00 ·  中国 湖北 武汉 联通
银牌会员
★★★
Credits 1,681
Posts 512
Joined 2003-08-02 00:00
23-year member
UID 7953
Gender Male
Status Offline
You should create a batch file cmdx.bat

@ECHO OFF
COMMAND /C %1 %2 %3 %4 %5 %6 %7 %8 %9

Then change “| command” to “| cmdx”... If it still doesn't work then bat2com
Somehow somewhere I've got to choose.
No matter if it is win or lose.
Forum Jump: