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-07-23 16:01
中国DOS联盟论坛 » DOS启动盘 & LOGO技术 (启动盘室) » I’ve already managed to find the last partition on the hard disk View 1,305 Replies 6
Original Poster Posted 2003-09-15 00:00 ·  中国 广东 深圳 福田区 电信
初级用户
Credits 150
Posts 7
Joined 2003-04-10 00:00
23-year member
UID 1463
Gender Male
Status Offline
It must be used together with STRINGS.COM
XSET.EXE


http://www.ipdown.com/dosbbs/dispbbs.asp?boardID=11&ID=7049

reply #6


Floor 2 Posted 2003-09-16 00:00 ·  中国 福建 福州 电信
元老会员
★★★
农民
Credits 2,903
Posts 991
Joined 2003-07-23 00:00
23-year member
UID 7391
Gender Male
From 福建省
Status Offline
How did you do it? Tell us about it.
艰难奋长戟,万古用一夫

中国DOS联盟 http://www.cn-dos.net 欢迎大家来共同学习
我的MSN&E-Mail cn_archer@hotmail.com QQ 56049418
Floor 3 Posted 2003-09-16 00:00 ·  中国 广东 深圳 福田区 电信
初级用户
Credits 150
Posts 7
Joined 2003-04-10 00:00
23-year member
UID 1463
Gender Male
Status Offline
Question: How do you get the drive letter of the CD-ROM drive?

Answer: You can use the FINDCD program in this site's "script tools" to automatically display the CD-ROM drive letter. For example, the FINCDCD command can display the current CD-ROM drive letter and put it into the environment variable %CDROM%. In addition, I wrote a batch file that will automatically find the drive letter of the CD-ROM drive, display the result, and store it in the environment variable %CDROM%. But it requires two batch enhancement programs, Strings 2.5 and XSET 5.47, both of which can be downloaded from this site's "script tools". The contents of the file are as follows:

@echo off
set dn=66
set cdrom=
:count
strings dn=add %dn%,1
strings dr=char %dn%
xset /search "CDROM" drv drivetest %dr%
if not %drv%#==# goto ok
if %dn%#==90# goto no
goto count
k
set cdrom=%dr%
echo The CD-ROM drive letter %cdrom% has been assigned to the variable "CDROM".
goto end
:no
echo No CD-ROM found!
:end
set dr=
set dn=
set drv=
echo.

In this example, it determines the drive letter where the CD-ROM is located. If you want to determine the drive letter of some other storage device (or RAM disk, etc.), just change "CDROM" in the line "xset /search "CDROM" drv drivetest %dr%" in the file above to some other name. For example, for a RAM disk you can replace "CDROM" with "RAM".

If you have any opinions or suggestions, you can email me or leave me a message. Thanks!

A very powerful enhanced SET command, with dozens of functions. Besides powerful character operations, file operations, and other functions, it can also create windows, change colors, set passwords, and so on. It supports long filenames and DOS windows under Win3.x/9x/NT/2K/XP. It has a great many options, with full-screen help (you can use the XSET command directly for that, or read its help file). For example, XSET Dr DRIVETEST C can store the detailed status of drive C in the environment variable %DS%, including the drive type, such as HARDDISK (that is, hard disk), FLOOPY (that is, floppy disk), CDROM (that is, CD), RAM (that is, RAM disk), SUBST (that is, virtual drive), REMOTE (that is, remote drive), and so on, as well as whether it is ready, whether it is read-only, whether it is a removable disk, and other information. The latest version released this May.
Floor 4 Posted 2003-10-07 00:00 ·  中国 广东 广州 天河区 电信
初级用户
★★★
Credits 1,480
Posts 377
Joined 2003-06-06 00:00
23-year member
UID 3875
Gender Male
Status Offline
Using just DREADY is enough, because DOS can only recognize FAT systems. If it's a CD-ROM drive, you can rule it out by seeing whether it can be written to...
欢迎大家访问我的主页!
精品.爱好http://iso.533.net
Floor 5 Posted 2003-10-07 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
The following is quoted from 电吉入侵's post on 2003-10-7 9:50:37:
Using just DREADY is enough, because DOS can only recognize FAT systems. If it's a CD-ROM drive, you can rule it out by seeing whether it can be written to...


What use is that? What if it's a write-protected floppy drive or a read-only network drive?
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 6 Posted 2003-10-08 00:00 ·  中国 福建 福州 电信
初级用户
Credits 112
Posts 4
Joined 2003-09-21 00:00
22-year member
UID 10126
Gender Male
Status Offline
There is another problem. Under DOS, drive letters seem to be assigned by recognizing primary partitions first, and then logical partitions inside the extended partition.

For example: there is a 40G hard disk, partitioned as follows: (all are FAT32)
   Partition 1: 10G primary partition (active)
   Partition 2: 25G extended partition (divided into two logical partitions: 10G, 15G)
   Partition 3: 5G  primary partition

Under DOS, the partition drive letters should be assigned like this:
   Partition 1: 10G primary partition (active)  ----> C:
   Partition 2: 25G extended partition (divided into two logical partitions: 10G, 15G) --->E: F:   
   Partition 3: 5G  primary partition      ----> D:

So:
   the last drive letter, F, is not the last partition.
  
   *actually, the drive letter of the last partition should be D


Floor 7 Posted 2003-10-08 00:00 ·  中国 福建 福州 电信
初级用户
Credits 112
Posts 4
Joined 2003-09-21 00:00
22-year member
UID 10126
Gender Male
Status Offline
Personally, I think:

  the best method should be to start from the partition table!
Forum Jump: