![]() |
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-09-23 15:49 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » How to get the drive letter of the last partition of the local hard disk under DOS? |
| Printable Version 2,732 / 12 |
| Floor1 sglxy | Posted 2005-10-05 14:03 |
| 中级用户 Posts 87 Credits 397 | |
|
In the process of computer maintenance, I often encounter such a problem:
The machine being maintained once had a system image file made by GHOST, but I don't know which partition and which directory on the hard disk it is placed in. So I am considering that if I compile a batch file, let it automatically obtain all the drive letters of the current hard disk, and then use the command dir /s/e "drive letter":\*.gho to find the image file. But now I don't know which program under DOS has this function, which can list all the partition drive letters on the current hard disk. I remember that a brother once asked a similar question on the forum. At that time, a expert provided him with a small program under DOS, which can very conveniently output all the partition numbers of the current hard disk in the form of one partition number per line to a text file. At that time, I didn't pay attention, but now I can't find that post at all. Does that brother know, or is there another good way to solve it? Please tell me, thank you! [ Last edited by willsort on 2005-10-6 at 23:02 ] |
|
| Floor2 willsort | Posted 2005-10-05 15:11 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re sglxy:
For your situation, you can consider using locate to locate the path of the gho file. This program can be found in the super startup disk of this forum. The usage is similar to: locate *.gho /n /f1 /b9:"ghost ...." > _restore.bat call _restore.bat ... |
|
| Floor3 sglxy | Posted 2005-10-05 18:00 |
| 中级用户 Posts 87 Credits 397 | |
|
Thanks to teacher willsort for the explanation. The locate program is really something I've never seen before. Maybe I've only used "Super Boot Disk" before and never paid attention to it.
|
|
| Floor4 不得不爱 | Posted 2005-10-05 19:45 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Can I use the ncd command?
|
|
| Floor5 不得不爱 | Posted 2005-10-05 19:50 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Attachments ncd.cab (64.42 KiB) |
|
| Floor6 sglxy | Posted 2005-10-05 20:42 |
| 中级用户 Posts 87 Credits 397 | |
|
Thank you, may I ask how to use the ncd command in batch processing?
|
|
| Floor7 不得不爱 | Posted 2005-10-06 09:13 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Please run `ncd` in DOS and view the help.
|
|
| Floor8 sglxy | Posted 2005-10-06 12:23 |
| 中级用户 Posts 87 Credits 397 | |
Originally posted by willsort at 2005-10-5 03:11 PM: Teacher willsort, in the line of command you listed: locate *.gho /n /f1 /b9:"ghost ...." > _restore.bat Does it mean that the search result of "locate *.gho /n /f1 /b9:" is output as a variable to the ghost command line? Then what is the variable name? |
|
| Floor9 willsort | Posted 2005-10-06 15:37 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re: sglxy:
This sentence means embedding the output of locate into the ghost command line, adding a line @echo off and then outputting, we redirected this output to the batch _restore.bat, and then we called it. But considering that locate will default to taking the path of the searched image file as the first parameter, and the ghost command line may not allow this usage, so saving the path to an environment variable may be a more appropriate usage. As follows: |
|
| Floor10 sglxy | Posted 2005-10-06 22:18 |
| 中级用户 Posts 87 Credits 397 | |
|
I understand now, Teacher willsort, thank you!
|
|
| Floor11 不得不爱 | Posted 2005-10-09 08:50 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
May I ask Moderator willsort where to download locate?
|
|
| Floor12 sglxy | Posted 2005-10-09 12:29 |
| 中级用户 Posts 87 Credits 397 | |
|
This program can be found in the super boot disk of this forum.
|
|
| Floor13 chujiafu | Posted 2005-10-09 18:33 |
| 银牌会员 Posts 595 Credits 1,339 From 安徽 宿州 | |
|
What if the .gho file is hidden? Can Locate be used? Instead of using an automatic method, it's better to use a manual method: Dir d:\.gho/s or Dir d:\.gho/s/a. This is for searching the D drive, and the method for searching other drives is the same.
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |