|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『楼 主』:
DOS下如何让批处理自动识别某个盘符是第几个分区?
使用 LLM 解释/回答一下
前言:在DOS下使用GHOST命令行形式时,若要把镜像恢复到分区,GHOST会自动把D盘识别为第2个分区,E盘为第3个分区。。。。。。
但假如中间存在NTFS格式分区和隐藏分区时,E盘就不是第3个分区,F盘也不是第4个分区了。
例子:如果C盘是FAT32分区,D盘是隐藏分区,E盘是NTFS分区,F盘是FAT32分区,在DOS下D盘和E盘是不会显示的,F盘变成了D盘,
问题提出:在DOS下如何让批处理自动识别D盘(实际是F盘)就是硬盘中的第4个分区而不是第2个分区?
Foreword: When using the GHOST command-line form under DOS, when restoring an image to a partition, GHOST will automatically recognize the D drive as the second partition, the E drive as the third partition, and so on. However, if there are NTFS-formatted partitions and hidden partitions in between, the E drive is not the third partition, and the F drive is not the fourth partition. Example: If the C drive is a FAT32 partition, the D drive is a hidden partition, the E drive is an NTFS partition, and the F drive is a FAT32 partition, the D drive and E drive will not be displayed under DOS, and the F drive becomes the D drive. Problem proposal: How to make the batch processing automatically recognize the D drive (actually the F drive) as the fourth partition in the hard drive instead of the second partition under DOS?
|
|
2004-4-22 00:00 |
|
|
Climbing
铂金会员
       网络独行侠
积分 6962
发帖 2753
注册 2003-4-16 来自 河北保定
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
你是不是把问题搞的太复杂了?GHOST从来都不以盘符为恢复的依据,可以说它只认分区。
仔细想一下你要干什么,然后再去决定如何干。
Are you overcomplicating the problem? GHOST never relies on drive letters for restoration; it can be said that it only recognizes partitions. Think carefully about what you want to do, and then decide how to do it.
|

偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
|
|
2004-4-22 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
简单的说,我是想把IBM一键恢复分区所需的文件如IO.SYS、COMMAND.COM等启动文件及GHOST.EXE文件用GHOST打包成一个*.gho文件,然后用PQMAGIC在硬盘分一个主分区(如E盘,卷标SYS_GHOST),再将*.gho文件用GHOST恢复到E盘中去(当然这个过程我只想在DOS自动执行)。这样开机就可以按F11键恢复系统了。
但将*.gho文件用GHOST恢复到E盘过程中,因为GHOST不以盘符为恢复的依据,它只认分区,在硬盘没有隐藏分区及NTFS格式分区情况下,E盘(SYS_GHOST分区)就是第3分区;但如果D盘是NTFS格式分区,这个SYS_GHOST分区在DOS下变成D盘了。
所以如何让DOS识别SYS_GHOST分区是第几个分区就变得复杂了。
Simply put, I want to package the boot files such as IO.SYS, COMMAND.COM and the GHOST.EXE file required for the IBM one-key recovery partition into a *.gho file using GHOST, then use PQMAGIC to divide a primary partition (such as drive E, volume label SYS_GHOST) on the hard drive, and then restore the *.gho file to drive E using GHOST (of course, I just want this process to be automatically executed in DOS). Then I can press the F11 key to restore the system when booting.
However, during the process of restoring the *.gho file to drive E with GHOST, since GHOST does not use the drive letter as the basis for restoration, it only recognizes the partition. If there are no hidden partitions and NTFS format partitions on the hard drive, the SYS_GHOST partition (drive E) is the third partition; but if drive D is an NTFS format partition, this SYS_GHOST partition becomes drive D in DOS.
So how to make DOS recognize which partition the SYS_GHOST partition is becomes complicated.
|
|
2004-4-22 00:00 |
|
|
ggtt
初级用户
 
积分 146
发帖 14
注册 2004-4-23
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
看不明白你想说什么,希望下面的对你有用
rem d:\ghost.exe -clone,mode=pload,src=e:\recover.gho:1,dst=1:1 -sure -rb
rem -sure ------表示对所有问题回答YES
rem -rb ------表示完成后自动重新启动
rem -fx ------GHOST完成工作后不显示(Press Ctrl-Alt-Del to reboot),而是直接回到DOS状态
mode=pload 恢复分区
dst=1:1 第一硬盘 第一分区
如果是src=不好确定可以用if exist 一个一个试
I can't understand what you're trying to say. Hope the following is helpful
rem d:\ghost.exe -clone,mode=pload,src=e:\recover.gho:1,dst=1:1 -sure -rb
rem -sure ------Indicates to answer YES to all questions
rem -rb ------Indicates automatic reboot after completion
rem -fx ------After GHOST finishes working, it doesn't display (Press Ctrl-Alt-Del to reboot), but directly returns to the DOS state
mode=pload Restore partition
dst=1:1 First hard disk, first partition
If it's not easy to determine with src=, you can use if exist to test one by one
|
|
2004-4-23 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
唉,你们都不明白的了。幸好一键恢复精灵作者饶晓超能理解,并且准备编出一个有这样功能的程序。
Alas, you all don't understand. Fortunately, Rao Xiaochao, the author of One-key Recovery Elf, can understand and is preparing to develop a program with such a function.
|
|
2004-4-24 00:00 |
|
|
Tamm
中级用户
  
积分 397
发帖 64
注册 2004-4-18
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
看了半天还是没有十分看懂你的意思
希望这些办法对你有用:
1: 如果你事先知道你要操作的目的分区在物理硬盘上排列是为第几个分区,那么 GHOST 恢复的时候根本不存在问题,因为 GHOST 从影象文件恢复到分区的操作时,用于指明目的分是使用 "磁盘:分区" 这样的格式,(比如 DST=1:3)
2:如果并不知道分区是第几个物理分区,但知道分区的卷标是什么,那么你可以使用 Gdisk 和 lmod 这两个工具结合查出它是第几个物理分区,具体操作有点复杂,不过还是可行的.
简单说一下流程:
Gdisk 1 >temp.txt 获得指定硬盘的分区列表到一个临时文本
find "label" temp.txt >temp1.txt 用卷标作为关键字提取相关分区的那一行
用 lmod 分析这一行中的信息(具体操作略) 因为 Gdisk 获得的分区列表是有一个固定格式的
所以能用 lmod 全面分析而得到想要的信息.
通过查找这一行中是 "PRIMARY" 还是 "LOGICAL" 以判断其是主分区还是逻辑分区.
因为 Gdisk 表示分区的编号与 Ghost 有所不同, Gdisk 中在主分区和逻辑分区中间会编号一个 "EXTENDED" 扩展分区.所以,Gdisk 显示的分区编号要用于 Ghost 的话就要经过处理才行
具体处理其实也容易,那就是:如果是主分区,就直接使用编号就行了,如果是逻辑分区,就把编号减1 就行了。
把上面的办法变通一下,你也可以用 LMOD 检查已知盘符的分区是物理分区中的第几个分区...
(不适用于 NTFS 分区)
After looking at it for a long time, I still don't quite understand what you mean.
Hope these methods are useful to you:
1: If you know in advance which partition it is in the physical hard drive arrangement for the purpose of the operation you want to perform, then there will be no problem at all when restoring with GHOST, because when GHOST restores from the image file to the partition, it uses the format of "disk:partition" to specify the destination partition. (For example, DST=1:3)
2: If you don't know which physical partition the partition is, but you know what the volume label of the partition is, then you can use the two tools Gdisk and lmod together to find out which physical partition it is. The specific operation is a bit complicated, but it is still feasible.
Briefly talk about the process:
Gdisk 1 >temp.txt Get the partition list of the specified hard drive to a temporary text
find "label" temp.txt >temp1.txt Extract the relevant partition line using the volume label as the keyword
Analyze the information in this line with lmod (the specific operation is omitted) Because the partition list obtained by Gdisk has a fixed format
So lmod can be used for comprehensive analysis to get the desired information.
Determine whether it is a primary partition or a logical partition by finding whether this line is "PRIMARY" or "LOGICAL".
Because the numbering of partitions in Gdisk is different from that in Ghost. There will be an "EXTENDED" extended partition numbered between the primary partition and the logical partition in Gdisk. So, the partition number displayed by Gdisk needs to be processed before being used in Ghost.
In fact, the specific processing is also easy, that is: if it is a primary partition, just use the number directly; if it is a logical partition, just subtract 1 from the number.
By modifying the above method, you can also use LMOD to check which partition the known drive letter is in the physical partition...
(Not applicable to NTFS partitions)
|
|
2004-4-24 00:00 |
|
|
Tamm
中级用户
  
积分 397
发帖 64
注册 2004-4-18
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
@ECHO OFF
gdisk 1 > %temp%\temp.txt
TFind /f30,10 "label" %temp%\temp.txt >%temp%\temp1.txt
type %temp%\temp1.txt | lmod set type=set part= >%temp%\temp.bat
call %temp%\temp.bat
if %type%==LOGICAL count part -1
set type=
del %temp%\temp*.*
:end
以上是通过卷标查找分区号的批处理 (只需将第三行 "label" 改为实际的卷标即可)
如果要通过盘符查找分区号,则将下面这一行替换上述批处理中的第三行:
Tfind /f2,2 "E:" %temp%\temp.txt >%temp%\temp1.txt
(这里以查找 E: 盘为例)
执行结果将分区号写入变量 %part%
本批处理使用了Norton 的 Gdisk 以及 Horst Schaeffer 的三个小程序: LMOD TFind COUNT
@ECHO OFF
gdisk 1 > %temp%\temp.txt
TFind /f30,10 "label" %temp%\temp.txt >%temp%\temp1.txt
type %temp%\temp1.txt | lmod set type=set part= >%temp%\temp.bat
call %temp%\temp.bat
if %type%==LOGICAL count part -1
set type=
del %temp%\temp*.*
:end
The above is a batch script to find the partition number through the volume label (just change the third line "label" to the actual volume label).
If you want to find the partition number through the drive letter, replace the third line in the above batch script with the following line:
Tfind /f2,2 "E:" %temp%\temp.txt >%temp%\temp1.txt
(taking finding drive E: as an example here)
The execution result writes the partition number into variable %part%.
This batch script uses Norton's Gdisk and three small programs by Horst Schaeffer: LMOD TFind COUNT
|
|
2004-4-25 00:00 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Re walu:
所以如何让DOS识别SYS_GHOST分区是第几个分区就变得复杂了。
你的意思是否可以这样表述——如何确定DOS系统能识别出的某个盘是硬盘的第几个分区,然后将这个分区号码置于命令行参数中供GHOST调用?
Re walu:
So how to make DOS recognize which partition the SYS_GHOST is becomes complicated.
Do you mean it can be expressed like this - how to determine which partition of the hard disk the disk recognized by the DOS system is, and then place this partition number in the command line parameters for GHOST to call?
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2004-4-25 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
以下是引用willsort在2004-4-25 10:52:26的发言:
Re walu:
你的意思是否可以这样表述——如何确定DOS系统能识别出的某个盘是硬盘的第几个分区,然后将这个分区号码置于命令行参数中供GHOST调用?
willsort实在是高!就是这个意思。
批处理方面,willsort和Climbing都是顶尖级的高手!
请问这个问题可以通过批处理解决吗?
The following is a quote from willsort on 2004-4-25 10:52:26:
Re walu:
Does your meaning mean that we can determine which partition of the hard disk the disk recognized by the DOS system is, and then place this partition number in the command line parameter for GHOST to call?
willsort is really brilliant! That's the very meaning.
In terms of batch processing, willsort and Climbing are both top-notch experts!
Can this problem be solved through batch processing?
|
|
2004-4-25 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
问题已基本解决,感谢Tamm兄弟!
The problem has been basically solved, thanks to Brother Tamm!
|
|
2004-4-26 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
对于Tamm兄弟的这一句“如果是主分区,就直接使用编号就行了,如果是逻辑分区,就把编号减1 就行了”(如果用PQMAGIC在第一主分区上分出一个主分区后这一句不会出错)
仍是有错。因为如果用PQMAGIC在扩展分区上分出一个主分区后,直接使用编号就会出错,因GDISK虽认出了这是个主分区,但仍把它纳入逻辑分区中算分区号。
For the sentence by Brother Tamm: "If it's a primary partition, just use the number directly; if it's a logical partition, just subtract 1 from the number" (this sentence won't be wrong if you use PQMAGIC to split a primary partition on the first primary partition). There is still an error. Because if you use PQMAGIC to split a primary partition on an extended partition, directly using the number will cause an error, because although GDISK recognizes that this is a primary partition, it still includes it in the logical partitions to count the partition number.
|
|
2004-4-26 00:00 |
|
|
Tamm
中级用户
  
积分 397
发帖 64
注册 2004-4-18
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
以下是引用walu在2004-4-26 11:46:22的发言:
......如果用PQMAGIC在扩展分区上分出一个主分区后,直接使用编号就会出错,因GDISK虽认出了这是个主分区,但仍把它纳入逻辑分区中算分区号。
我没看明白...
你说 “... 如果用PQMAGIC在扩展分区上分出一个主分区后 ... ”
在扩展分区上怎么建立主分区呢...?
你的意思是用PQ把扩展分区缩小,然后在硬盘的扩展分区后面留出的那一部分再建立第二个主分区吗?
也就是这样?:
不好意思,我提出这个方案的时候确实没有考虑过这样的情况。
如果是这样的话,Gdisk 会使用这样的编号:
1 第一主分区
2 第二主分区
3 扩展分区
4... 扩展分区下的逻辑分区
但是我不知道 Ghost 在这样的情况下是如何使用分区编号的......
The following is a quote from walu on 2004-4-26 11:46:22:
......If you use PQMAGIC to divide a primary partition on an extended partition, directly using the number will cause an error because although GDISK recognizes this as a primary partition, it still includes it in the logical partition to count the partition number.
I don't understand...
You said "... If you use PQMAGIC to divide a primary partition on an extended partition ..."
How can you create a primary partition on an extended partition...?
Do you mean using PQ to shrink the extended partition, and then create a second primary partition in the part left behind after the extended partition on the hard disk?
That is, like this?:
I'm sorry, I didn't consider such a situation when I proposed this plan.
If that's the case, Gdisk will use the following numbering:
1 First primary partition
2 Second primary partition
3 Extended partition
4... Logical partitions under the extended partition
But I don't know how Ghost uses the partition number in such a situation......
|
|
2004-4-26 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Tamm兄弟,我已找到另外一个程序代替GDISK就很完美了,但这个程序执行它后都出现“Press any key to continue...”即要求按任意键才能继续执行后面的程序,我不想用手工按任意键,而想执行它后自动接着执行后面的程序,请问要怎样做?
Brother Tamm, I have found another program to replace GDISK, which is perfect. But after executing this program, it all appears "Press any key to continue...", that is, it requires pressing any key to continue executing the subsequent program. I don't want to use manual key pressing, and I want to execute it and then automatically continue executing the subsequent program. How should I do it?
|
|
2004-4-26 00:00 |
|
|
Tamm
中级用户
  
积分 397
发帖 64
注册 2004-4-18
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
能不能赐教...
使用什么代替的?
^_^
Can you kindly give some advice...
What was used as a substitute?
^_^
|
|
2004-4-26 00:00 |
|
|
walu
高级用户
   
积分 916
发帖 201
注册 2003-5-4
状态 离线
|
|
2004-4-26 00:00 |
|