1.

Solve : Promt for user input in autoexec.bat?

Answer»

Hello!
Im trying to make an autoexec which goal is to execute and ghostinstallation of windows xp.
That part I have got working but what I need is to give the user a warning that by using this ghost cd everything will be wiped out of the c drive and want to ask them if they are sure about this.

This is my code so far, i´ve TESTED with both set /p and choice so I will put both of them up here. Maybe some can come up with an answer what I am missing.

With the choice command:

@ECHO OFF
:start
cls
ECHO Are you sure that you want to install Windows?
ECHO 1=Install
ECHO 2=Quit
choice /N /C:12 To install press 1 OTHERWISE press 2 (1, 2)%1
IF ERRORLEVEL ==2 goto quit
IF ERRORLEVEL ==1 goto install
:install
cls
choice /N /C:12 Are you sure? 1=Yes 2=No (1, 2)%1
IF ERRORLEVEL ==2 goto quit
IF ERRORLEVEL ==1 goto reinstall
:reinstall
ECHO Whoho! It works!
pause
:quit
exit


With the set /p command: (This one works fine in win xp which it should...)

@echo off
cls
:start
ECHO.
ECHO 1. Install
ECHO 2. Exit Installation
set choice=
set /p choice=Press 1 to continue installation of Windows. Press 2 to exit installation.
if '%choice%'=='1' goto install
if '%choice%'=='2' goto quit
ECHO "%choice%" is not valid please try again.
ECHO.
goto start
:install
ECHO 1. Yes
ECHO 2. No
set question=
set /p question=Are you sure? 1/2.
if '%question%'=='1' goto ghost
if '%question%'=='2' goto quit
ECHO "%question%" is not a valid please try again.
goto install
:ghost
ECHO Whoho! It works!
pause
:quit
exit


I hope SOMEONE will have the time to look at it and maybe has the answer on what im doing wrong.

Best regards/ Petermaybe the fact of this
C:\>choice
Bad Command of filenameQuote from: mat123 on May 20, 2010, 07:36:10 AM

maybe the fact of this
C:\>choice
Bad Command of filename

Sorry I probably forgot to mention that it isnt in Windows XP i want to run this, but when booting up the computer...

Didnt know by the time I was writing this thread that the "set /p" command only works in windows but not in DOS.
So the last code example is not usable.

The code part using the "choice" command is for DOS and that is the code im having problem with.try it without
(1, 2)%1
replace
IF ERRORLEVEL == 2
ERRORLEVEL 2
etc.Quote from: mat123 on May 20, 2010, 07:55:20 AM
try it without
(1, 2)%1
replace
IF ERRORLEVEL == 2
ERRORLEVEL 2
etc.

Ok thanks I will trymat123 means

IF ERRORLEVEL 2 goto quit
IF ERRORLEVEL 1 goto install

etc

Quote from: Salmon Trout on May 20, 2010, 12:34:36 PM
mat123 means

IF ERRORLEVEL 2 goto quit
IF ERRORLEVEL 1 goto install

etc



Tried it and it didnt work. :/
Okay,
So now I´ve tried all of the possibilities I know of regarding this so I´ve have started on a new idea which I would like to hear thoughts about this idea of mine.

What about if I in "autoexec.bat" write a command which executes another program on the CD which then writes out the warning about reinstalling the computer with this ghost cd and promt the user for an input? If the user answers that it wants to run the ghost installation it executes the ghost installation from that program INSTEAD?

Is it possible to do so and if it is, which programming language is the easiest to learn to write such program?

Best regards/ PeterIn my opinion, VB6 is a viable option(Although you ought to look around to C++ and other programming languages for your "Programming-Style")

But before you goto that, Can you give us details about Autoexec:
  • The version of Windows it'll be running on(Not the ghost installation of XP).
  • Location of Autoexec

Thanks,
Nick(macdad-)


Discussion

No Comment Found