China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-23 05:12
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » (Solved) Ask: How to detect whether a partition is an active partition View 3,774 Replies 14
Original Poster Posted 2007-03-10 12:32 ·  中国 广东 深圳 罗湖区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
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 ]
Floor 2 Posted 2007-03-10 12:36 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  The following one?

echo %systemdrive%
Floor 3 Posted 2007-03-10 21:50 ·  中国 广东 深圳 龙岗区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
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.
Floor 4 Posted 2007-03-11 19:29 ·  中国 山东 临沂 电信
中级用户
★★
Credits 208
Posts 97
Joined 2006-12-28 22:08
19-year member
UID 74845
Gender Male
Status Offline
Now everyone treats cmd as a panacea, just short of how to cook with cmd◎!
Floor 5 Posted 2007-03-11 22:21 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
  Ask for advice, what is the boot partition?
Floor 6 Posted 2007-03-12 10:12 ·  中国 广东 深圳 龙岗区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
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.
Floor 7 Posted 2007-03-12 10:19 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Oh, I don't know about this. Let's see if other experts in the forum have any solutions.
Floor 8 Posted 2007-03-13 00:28 ·  中国 广东 深圳 宝安区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
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!
Floor 9 Posted 2007-03-13 01:31 ·  中国 江苏 连云港 电信
高级用户
★★★
前进者
Credits 641
Posts 303
Joined 2007-01-10 02:57
19-year member
UID 76009
Gender Male
Status Offline
wmic partition get name,bootpartition,bootable
我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿!
Floor 10 Posted 2007-03-13 01:52 ·  中国 广东 深圳 宝安区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
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?
Floor 11 Posted 2007-03-13 02:30 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
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
Windows 一键还原
http://www.yjhy.com
Floor 12 Posted 2007-03-13 03:42 ·  中国 广东 深圳 宝安区 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
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.
Floor 13 Posted 2007-03-13 05:27 ·  中国 重庆 电信
新手上路
Credits 10
Posts 5
Joined 2006-10-18 03:25
19-year member
UID 66226
Gender Male
Status Offline
How nice it would be if I could be as good as some people
Floor 14 Posted 2007-03-13 06:50 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
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.
Floor 15 Posted 2007-12-24 10:39 ·  中国 陕西 西安 联通
新手上路
Credits 12
Posts 7
Joined 2006-03-11 17:41
20-year member
UID 51819
Status Offline
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.
Forum Jump: