中国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-29 08:53
47,816 topics / 349,916 posts / today 0 new / 48,265 members
DOS批处理 & 脚本技术(批处理室) » (Solved) Ask: How to detect whether a partition is an active partition
Printable Version  4,004 / 14
Floor1 willsion Posted 2007-03-10 12:32
高级用户 Posts 312 Credits 793
As the title says, how to use batch processing to detect whether a partition is an active (active) partition, that is, the partition from which the system starts (usually the C drive, but it may also be the D drive).

Please give your advice, great experts.

Thanks.

[ Last edited by willsion on 2008-9-22 at 01:25 PM ]
Floor2 lxmxn Posted 2007-03-10 12:36
版主 Posts 4,938 Credits 11,386

  The following one?
Floor3 willsion Posted 2007-03-10 21:50
高级用户 Posts 312 Credits 793
The friend upstairs may have misunderstood my meaning. I mean the boot partition, not the partition where the system is installed. The command upstairs is to display the partition where the current operating system is located.
Floor4 zhxy9804 Posted 2007-03-11 19:29
中级用户 Posts 97 Credits 208
Now everyone treats cmd as a panacea, just short of how to cook with cmd◎!
Floor5 lxmxn Posted 2007-03-11 22:21
版主 Posts 4,938 Credits 11,386
  Ask for advice, what is the boot partition?
Floor6 willsion Posted 2007-03-12 10:12
高级用户 Posts 312 Credits 793
Originally posted by lxmxn at 2007-3-11 10:21 PM:
  I would like to ask, what is a boot partition?

I'm sorry, I might not have made it clear.

The boot partition I'm referring to is the partition set as "active" (activated) during the hard disk partitioning operation.
Floor7 lxmxn Posted 2007-03-12 10:19
版主 Posts 4,938 Credits 11,386
Oh, I don't know about this. Let's see if other experts in the forum have any solutions.
Floor8 willsion Posted 2007-03-13 00:28
高级用户 Posts 312 Credits 793
Originally posted by lxmxn at 2007-3-12 10:19 AM:
Oh, I don't know about this. Let's see if other experts in the forum have any solutions.


Thanks!
Floor9 oilio Posted 2007-03-13 01:31
高级用户 Posts 303 Credits 641
wmic partition get name,bootpartition,bootable
Floor10 willsion Posted 2007-03-13 01:52
高级用户 Posts 312 Credits 793
Originally posted by oilio at 2007-3-13 01:31 AM:
wmic partition get name,bootpartition,bootable


Is there a way to convert the detected partitions (such as 0, 1) into the disk numbers (such as C:, D:) recognized by the current system?
Floor11 lianjiang2004 Posted 2007-03-13 02:30
金牌会员 Posts 1,884 Credits 3,946
Available third-party software.
Such as: dpitw.exe, ghost32, etc.
------------------------

No. Type PartitionType Active StartSector Sectors MBytes
0:1 Primary HPFS/NTFS Yes 63 15438402 7538
0:2 Primary Hide HPFS/NTFS 15438465 15293880 7467
0:3 Extended LBA 30732345 203704200 99464
0:4 Logic HPFS/NTFS 30732408 20482812 10001
0:5 Logic HPFS/NTFS 51215283 30732282 15005
0:6 Logic Win95 FAT32 81947628 61448562 30004
0:7 Logic HPFS/NTFS 143396253 90831447 44351
0:8 Logic Hide FAT16 234227763 208782 101
Floor12 willsion Posted 2007-03-13 03:42
高级用户 Posts 312 Credits 793
Originally posted by lianjiang2004 at 2007-3-13 02:30 AM:
Available third-party software.
Such as: dpitw.exe, ghost32, etc.
------------------------

No. Type PartitionType Active StartSector Sectors MBytes
0:1 Primary HPFS/NTFS ...


Give it a try, thanks.
Floor13 happygogo Posted 2007-03-13 05:27
新手上路 Posts 5 Credits 10
How nice it would be if I could be as good as some people
Floor14 everest79 Posted 2007-03-13 06:50
金牌会员 Posts 1,127 Credits 2,564
Originally posted by lxmxn at 2007-3-11 09:21 AM:
  Please ask, what is a boot partition?


An active partition refers to a partition that can be booted, that is, a partition with a boot mark 80. In NTFS, an active partition not only can be booted but also marks whether an operating system can be installed.
Floor15 leacry Posted 2007-12-24 10:39
新手上路 Posts 7 Credits 12
Try this: (for example, detecting drive C:)
*:\detect.bat c:

The following is the content of "detect.bat":

@echo off
if exist %1\ntldr goto y
echo This partition is not an active boot partition!
pause
goto exit

:y
echo %1 is an active boot partition!
pause
goto exit

:exit
exit

---------------------------------------------------
Prerequisite: There are installed systems of 2000, XP, 2003
If it is 98, me, you can replace "ntldr"
The principle is the same. If it is pure DOS, it is more troublesome~

A primary partition can have a maximum of 4, and the active partition
must be a primary partition, and the system's boot partition must also
be an active primary partition.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023