中国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-10-26 17:31
47,815 topics / 349,928 posts / today 0 new / 48,288 members
DOS启动盘 & LOGO技术 (启动盘室) » I’ve already managed to find the last partition on the hard disk
Printable Version  1,522 / 6
Floor1 mafa3 Posted 2003-09-15 00:00
初级用户 Posts 7 Credits 150
It must be used together with STRINGS.COM
XSET.EXE


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

reply #6


Floor2 cn_archer Posted 2003-09-16 00:00
元老会员 Posts 991 Credits 2,903 From 福建省
How did you do it? Tell us about it.
Floor3 mafa3 Posted 2003-09-16 00:00
初级用户 Posts 7 Credits 150
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.
Floor4 电吉入侵 Posted 2003-10-07 00:00
初级用户 Posts 377 Credits 1,480
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...
Floor5 Wengier Posted 2003-10-07 00:00
系统支持 Posts 10,521 Credits 27,736
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?
Floor6 绿叶林 Posted 2003-10-08 00:00
初级用户 Posts 4 Credits 112
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


Floor7 绿叶林 Posted 2003-10-08 00:00
初级用户 Posts 4 Credits 112
Personally, I think:

  the best method should be to start from the partition table!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023