![]() |
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-10 16:53 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Asking everyone, how can I use batch processing to determine the last drive letter? |
| Printable Version 2,339 / 11 |
| Floor1 zahy006 | Posted 2006-12-29 10:26 |
| 初级用户 Posts 23 Credits 69 | |
|
Batch scripts that can run under DOS and correctly find the last drive letter.
Actually, I'm trying to make a Ghost automatic backup and put it on the last drive letter. But I don't know how to specify it as the last drive letter. It needs to work on NTFS - formatted hard drives... Troubled seniors, please tell me, little brother is very grateful... Also... DOS supports NTFS. |
|
| Floor2 everest79 | Posted 2006-12-29 10:45 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
In this case, you shouldn't focus on the drive letters, but rather on the number of disks and partitions.
|
|
| Floor3 zahy006 | Posted 2006-12-29 10:46 |
| 初级用户 Posts 23 Credits 69 | |
|
The key is, I want to use it on different computers. If one computer has 3 partitions and another has 4 partitions, what should I do?
|
|
| Floor4 everest79 | Posted 2006-12-29 11:03 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
So that's why you need to find a way to get the number of disks and partitions. In DOS, for example, NTFS won't have a drive letter. And the problem with the number of disks is even bigger because Ghost uses its own logic for disk sequences. It defaults to the boot hard drive as the first disk, and only when booted from other devices will it judge according to the master-slave interface of IDE. You must get the number of disks and partitions if you want to use such a command. GHOST -clone,mode=pdump,src=%sd%:%sp%,dst=%dd%:%dp%\sys.gho -sure -z9 -rb
|
|
| Floor5 zahy006 | Posted 2006-12-29 11:05 |
| 初级用户 Posts 23 Credits 69 | |
|
Can't we directly determine the last drive letter to back it up?
|
|
| Floor6 everest79 | Posted 2006-12-29 11:15 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
I don't know if ghost has such a parameter
|
|
| Floor7 zahy006 | Posted 2006-12-29 13:20 |
| 初级用户 Posts 23 Credits 69 | |
|
Just now I've seen many methods and tried them. Except for the moderator's findcd (can't download), is there anyone who can help compile... Please everyone... As long as it can judge the last drive letter...
|
|
| Floor8 hhwwll | Posted 2006-12-29 13:39 |
| 中级用户 Posts 30 Credits 293 | |
|
@echo off
REM Determine the drive letter of the last FAT partition on the hard disk set na= set dif= func -a6 >>dtemp.txt STRINGS na=LINESIZE dtemp.txt STRINGS dif=READ dtemp.txt,%na% echo %dif% |
|
| Floor9 everest79 | Posted 2006-12-29 13:54 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
If you use Ghost, it has a built-in tool called GDISK.EXE. gdisk 1 displays the partition information of the first hard disk, and you can use this to retrieve.
|
|
| Floor10 ccwan | Posted 2006-12-29 21:05 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
Using the forum search, you can find many such posts. Take a look more to expand your ideas. Many are already closed posts.
|
|
| Floor11 lianjiang2004 | Posted 2006-12-29 21:09 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
Originally posted by zahy006 at 2006-12-29 11:05: The second floor has already said that Ghost only recognizes partition numbers, not drive letters, unless all are FAT formats (obviously, this is impossible). I refer to others' batch scripts, and the solution is, 1. Run Ghost -dd in DOS to get the last partition number of the first hard drive (I am only looking for the first hard drive), 2. Then run the Ghost command. |
|
| Floor12 不得不爱 | Posted 2006-12-29 21:16 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |