中国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-12 21:34
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Question about a command to find a hard disk and run a program:
Printable Version  1,058 / 5
Floor1 xiaojun Posted 2003-08-30 00:00
银牌会员 Posts 499 Credits 2,202
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!


Floor2 iceboy Posted 2003-08-30 00:00
银牌会员 Posts 512 Credits 1,681
Is the filename fixed?
Floor3 iceboy Posted 2003-08-30 00:00
银牌会员 Posts 512 Credits 1,681
dir c:\win.com /s/b/a | command
Then it can search for win.com on c:\, and if it finds it, execute it
Floor4 xiaojun Posted 2003-08-31 00:00
银牌会员 Posts 499 Credits 2,202
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?
Floor5 xiaojun Posted 2003-08-31 00:00
银牌会员 Posts 499 Credits 2,202
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?


Floor6 iceboy Posted 2003-09-05 00:00
银牌会员 Posts 512 Credits 1,681
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
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023