中国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-09-23 17:55
47,812 topics / 349,917 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » [Help] Can a batch file automatically find and enter a certain CD-ROM to run a specific
Printable Version  1,817 / 11
Floor1 北山愚公 Posted 2005-02-01 00:00
初级用户 Posts 15 Credits 154
I want to make a bootable CD, placing both the operating system's ghost backup and the ghost software on the CD. Since the bootable CD has a dual identity, the drive letter displayed after booting is drive A, while the ghost backup is on the CD drive, and it's inconvenient to switch drive letters when using it.

I thought that if I compile an independent ghost.bat and put it into the boot files, generally this CD is still used as a boot disk, and when I need to restore the ghost backup, I execute this file. Can the DOS system automatically execute the ghost file in the CD drive?

Because the drive letter of the CD drive on each computer varies greatly due to the different number of partitions. Some people have drive D, while some have drive G or others, and some computers even have an additional burner. I would like to ask all experts: How can I make DOS automatically find the CD drive and locate the disk where the CD is? How should this batch processing be written? Thanks in advance.
Floor2 JonePeng Posted 2005-02-01 00:00
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Method 1 (Using FINDCD.EXE):

There is a small program FindCD.exe in Wengier's MSDOS 7.1 boot disk. With it, it's easy to confirm the CD - ROM drive letter! When you run it, it will automatically store the CD - ROM drive letter in the %CDROM% environment variable. Then the GHOST.BAT can be written in a few lines (assuming the GHOST program is stored in the \GHOST folder on your CD - ROM):

@echo off
findcd
%cdrom%
cd\ghost
ghost

Method 2 (Modifying AUTOEXEC.BAT):

The MSCDEX or SHSUCDX command to drive the CD - ROM can set the CD - ROM to a specific drive letter. For example:

MSCDEX /D:IDE-CD /L:Z
or
SHSUCDX /D:IDE-CD,Z

No matter how many partitions the hard disk has, or even if there is no hard disk, you can set the CD - ROM to Z:. Then the batch processing is simpler:

@echo off
z:
cd\ghost
ghost

[ Last edited by JonePeng on 2005-11-29 at 13:16 ]
Floor3 北山愚公 Posted 2005-02-02 00:00
初级用户 Posts 15 Credits 154
Great! Thanks to Brother JonePeng for the guidance.
Floor4 mtx Posted 2005-02-02 00:00
初级用户 Posts 21 Credits 187
If the CD - ROM is set to Z: it will bring some troubles if there are several CD - ROMs. It is better to set the CD - ROM to a more appropriate letter.
Floor5 cn_archer Posted 2005-02-02 00:00
元老会员 Posts 991 Credits 2,903 From 福建省
You can use FoundCD to put the drive letter of the CD into a variable, and then use %CDROM% to directly jump to the CD. The FoundCD program can be found in Wengier's bootable disk.
Floor6 北山愚公 Posted 2005-02-02 00:00
初级用户 Posts 15 Credits 154
Thanks to the instructor's teachings. But I'm a newbie, and I'm most afraid of variables. Can you explain it in detail? Of course, if you can write out the entire batch file like the brother above, then it's the best, and I can also learn while imitating. Thanks. Another: Thanks to brother mtx from 4th floor for the reminder.
Floor7 cn_archer Posted 2005-02-03 00:00
元老会员 Posts 991 Credits 2,903 From 福建省
The JonePeng on the second floor has already made it very clear. Just follow his example to apply it. I didn't read his post carefully when I posted yesterday. I'm ashamed.
Floor8 zhouhb Posted 2006-04-21 13:52
中级用户 Posts 104 Credits 230
Great minds, I'm learning from you!
Floor9 kingchain Posted 2006-04-21 13:58
初级用户 Posts 57 Credits 133
Learning
Floor10 vct852 Posted 2006-04-28 02:17
初级用户 Posts 17 Credits 46
It's not to that point yet!
Floor11 xuantian Posted 2006-04-29 11:51
高级用户 Posts 282 Credits 587
When there are multiple CD - ROM drives, you can assign drive letters to the CD - ROM drives respectively, and there won't be any confusion.
Floor12 yeziwanlove Posted 2006-05-04 21:34
新手上路 Posts 6 Credits 15 From 河北
Study hard, thank you everyone!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023