Computing.Net > Forums > Programming > Need help with a Batch File

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Need help with a Batch File

Reply to Message Icon

Name: J.C.
Date: July 26, 2006 at 11:18:32 Pacific
OS: Win98 S.E.
CPU/Ram: 950/CPU 950MB/Ram
Product: Generic
Comment:

I am trying to write a Windows O.S. install batch. I want the install batch to allow me a choice before proceeding to the next step. I have added the batch to a Win98 Boot Floppy. The install batch is set to be called from within the autoexec.bat of the Win98 Boot Floppy. Thus far, when trying to use the batch, it allows me no choices. It goes directly into installing Win98 etc.. When testing the batch, if I do not have an Install Cd in the Cd-rom Drive, the batch goes directly to the Win98 section, then to the WinXP section and then to the Exit Section. What corrections do I need to make that will allow me a menu and/or choice?

NOTE: I have tried using a Win98.bat, WinXP.bat and an Exit.bat each being called from within the choice section of the install bat.., each has the same results as stated above.

Below is a copy of part of my batch file. Due to the length of my post, I left out the WinXP and Exit section of the install.bat.
{hopefully the website HTML will not change the text output of my batch}

@echo off

:start


echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Main Menu º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º 1. INSTALL WIN98 S.E. º
echo º 2. INSTALL WINXP PRO º
echo º 3. QUIT PROGRAM º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ

CHOICE /C:123

if errorlevel 3 GOTO QUIT PROGRAM
if errorlevel 2 GOTO INSTALL WINXP PRO
if errorlevel 1 GOTO INSTALL WIN98 S.E.

:INSTALL WIN98 S.E.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º   GETTING READY TO INSTALL WIN98 S.E.   º
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º   Making WIN98 Directory on Hard Drive for the Win98 Cabs   º
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
C:
md c:\win98
copy a:\msbatch.inf c:\win98
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º   Copying the Win98 Cabs From Cd-Rom to the Hard Drive   º
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
R:
copy *.* c:\win98
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º   All Files and Win98 Cabs have been copied to the Hard Drive   º
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º          Preparing to install Win98          º
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
C:\WIN98\SETUP.exe /ie /im /is



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: July 26, 2006 at 15:47:57 Pacific
Reply:

Hi
Try changing to
I think the the extra words are being ignored and the goto just go's the the first
one.
if errorlevel 3 GOTO QUIT PROGRAM
if errorlevel 2 GOTO WINXP PRO INSTALL
if errorlevel 1 GOTO WIN98 S.E. INSTALL



0

Response Number 2
Name: J.C.
Date: July 26, 2006 at 18:58:01 Pacific
Reply:

Below is a copy of my edits to the Batch Menu. However, I am still receiving the same results. When running the batch from within the Win98 Boot Floppy, everything goes to auto and starts to install Win98., thus it does not wait for a choice.

@echo off
echo 1 WIN98
echo 2 WINXP
echo 3 QUIT
echo.
echo.
CHOICE /C:123
if errorlevel 3 goto QUIT
if errorlevel 2 goto WINXP
if errorlevel 1 goto WIN98
:WIN98


0

Response Number 3
Name: Mechanix2Go
Date: July 26, 2006 at 20:56:32 Pacific
Reply:

Well, you've got it stripped down to the essentials.

Either the CHOICE is not setting the errorlevel [seems unlikely] or the GOTO section doesn't work.

I'm stumped.

Since you're using DOS, try prefixing the label names with colons:

if errorlevel 3 goto :QUIT
if errorlevel 2 goto :WINXP
if errorlevel 1 goto :WIN98

===



If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: J.C.
Date: July 27, 2006 at 06:05:53 Pacific
Reply:

Thanks, for the suggestions. I have tried everything as suggested, however nothing seems to correct the problem. Any suggestions as to a good DOS Menu Program?
J.C.


0

Response Number 5
Name: Mechanix2Go
Date: July 27, 2006 at 09:20:43 Pacific
Reply:

Hi J.C.

I'm out of ammo on this one.

I can't reboot in DOS right now, but this BAT is a case of "so simple it can't not work".

Keep us posted.


If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



Response Number 6
Name: J.C.
Date: July 27, 2006 at 10:19:46 Pacific
Reply:

Hi Mechanix2Go,

I do not understand the problem. As you stated, it is a simple Bat. I just tried it on another H.D. with the same none Choice results.
J.C.


0

Response Number 7
Name: Shr0Om
Date: July 27, 2006 at 12:08:01 Pacific
Reply:

Perhaps it would be an idea to boot from the floppy and then just try the Choice command at the prompt and see if it works.. (Remove the 98 installation from autoexe for now). If i remember correctly, choice is a "choice.com" file. Maybe its not included on the boot floppy?


0

Response Number 8
Name: J.C.
Date: July 27, 2006 at 13:12:19 Pacific
Reply:

I found the problem.
The "CHOICE.COM", was corrupt. I added a new "CHOICE.EXE & CHOICE.COM", to the Floppy. Everything works fine.

Thanks, for trying to help me sort out the problem.

J.C.


0

Response Number 9
Name: Mechanix2Go
Date: July 27, 2006 at 16:56:57 Pacific
Reply:

J.C.

Good deal; thanks for letting us know.


If at first you don't succeed, you're about average.

M2


0

Response Number 10
Name: bakss
Date: August 14, 2006 at 19:02:36 Pacific
Reply:

Good deal


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Need help with a Batch File

Help creating a Batch file urgent www.computing.net/answers/programming/help-creating-a-batch-file-urgent/15963.html

Need help with a batch file www.computing.net/answers/programming/need-help-with-a-batch-file/17269.html

Need Help with DOS batch file .. www.computing.net/answers/programming/need-help-with-dos-batch-file-/12751.html