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技术 (启动盘室) » Automatically get the drive letter of the last FAT partition on the hard disk! View 865 Replies 5
Original Poster Posted 2003-10-03 00:00 ·  中国 福建 福州 电信
初级用户
Credits 112
Posts 4
Joined 2003-09-21 00:00
22-year member
UID 10126
Gender Male
Status Offline
When assembling a machine, most people are used to making the last partition on the hard disk a backup partition, where they keep the Win98 installation files as well as the ghost backup of the system partition (usually the first partition), etc.

If a boot disk is given the function of automatically getting the drive letter of the last FAT partition on the hard disk, then automatic system backup and restore can be achieved.


How can I automatically get the drive letter of the last FAT partition on the hard disk?


Please help!


Floor 2 Posted 2003-10-03 00:00 ·  中国 广西 柳州 电信
高级用户
★★
Credits 570
Posts 173
Joined 2003-08-23 00:00
22-year member
UID 9077
Gender Male
Status Offline
There are many ways to achieve automatic system backup and restore; it doesn't have to depend on getting the drive letter of the last FAT partition on the hard disk.
Floor 3 Posted 2003-10-04 00:00 ·  中国 福建 福州 电信
初级用户
Credits 112
Posts 4
Joined 2003-09-21 00:00
22-year member
UID 10126
Gender Male
Status Offline
Actually, this is just one of my personal habits (and I believe it's also the habit of most people).
For example:
When installing Windows 98, it can automatically get the drive letter of the last FAT partition on the hard disk, copy the Win98 source files from the CD to that partition, and finally install Windows98 automatically from the hard disk. That way, when adjusting some Win98 settings, it won't keep prompting “insert the Win98 source CD,” and reinstalling Win98 is also convenient.
Floor 4 Posted 2003-10-06 00:00 ·  中国 广东 广州 白云区 电信
初级用户
★★★
Credits 1,480
Posts 377
Joined 2003-06-06 00:00
23-year member
UID 3875
Gender Male
Status Offline
Because MS-DOS7.1 can only recognize FAT format, you just need to look for the last drive letter..
I've answered a question like this before.. try searching for it
欢迎大家访问我的主页!
精品.爱好http://iso.533.net
Floor 5 Posted 2003-10-06 00:00 ·  中国 黑龙江 哈尔滨 联通
中级用户
新DOS时代绿色菜狼
Credits 229
Posts 42
Joined 2003-07-03 00:00
23-year member
UID 6341
Gender Male
Status Offline
I tried several times. If %cdrom% is loaded first, it didn't work (the lastdrv found was cdrom), so I had no choice but not to load it when entering the auto backup/restore option, and then load it again before entering the DOS command line option.

The following is for reference only:

Set the last drive letter as: %lastdrv%:\
Add dready.com

【AUTOEXEC.BAT】
set lastdrv=
for %%i in (w v u t s r q p o n m l k j i h g f e d c) do call chkdrv.bat %%i
if errorlevel 100 goto begin

【CHKDRV.BAT】
@echo off
if not %lastdrv%'==' goto _end
if %1'==' goto _end
if %1==%cdrom% goto _end
if %1==%RAMDRIVE% goto _end
dready.com %1 /w
if errorlevel 2 goto _end
set lastdrv=%1
:_end
Floor 6 Posted 2003-10-06 00:00 ·  中国 广东 深圳 福田区 电信
初级用户
Credits 150
Posts 7
Joined 2003-04-10 00:00
23-year member
UID 1463
Gender Male
Status Offline
Two methods, please refer to them.
Open attachment

%cdr%=the drive letter of the last FAT partition on the hard disk
Forum Jump: