Jump to content

Yes or No to Install Programs?


Recommended Posts

First of all i'd like to say thanks to everyone for this creating this great forum. I've been reading posts for most of the day and i've learn loads!!

I've created a DVD with XP Pro w/ SP2 + Drivers + Office 2003. All of which are working perfectly and there is more soon to be added.

But anyway, Office is installed using a batch file but is there a way to have a simple Yes or No question in a batch file?? Basically so it waits for the user to say wether it wants this program installing or not by pressing Y or N??

I know thats taking away the whole 'unattended' idea but it would be very helpful to me. :rolleyes:

Cheers :thumbup

Dan.

Link to comment
Share on other sites


Thanks for pointing me in the right direction!! :thumbup

The working code is as follows...

CLS

@echo off

TITLE Windows XP PRO w/ SP2 - Unattended Installation

ECHO.

ECHO Nearly Done!!!

ECHO.

ECHO Removing stupid shortcuts...

DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Set Program Access and Defaults.lnk"

DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Windows Catalog.lnk"

type nul>%temp%\~YesOrNo.tmp

echo Would You Like To Install Office 2003 Pro [y/n]?

del /p %temp%\~YesOrNo.tmp>nul

if not exist %temp%\~YesOrNo.tmp goto Yes

Echo Selected "No"

del %temp%\~YesOrNo.tmp

goto end

:Yes

Echo Selected "Yes"

ECHO.

ECHO Installing Office 2003 Pro :)

ECHO Please wait...

start /wait %systemdrive%\install\Applications\Office2003\setup.exe TRANSFORMS=Unattended.MST /qb-

ECHO.

ECHO Restarting the PC in 10 seconds...

shutdown.exe -r -f -t 10 -c "Windows XP will restart in 10 seconds, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

:End

ECHO.

ECHO Deleting Temp Installation Files...

RD /S /Q %systemdrive%\install

EXIT

Link to comment
Share on other sites

type nul>%temp%\~YesOrNo.tmp

echo Would You Like To Install Office 2003 Pro [y/n]?

del /p %temp%\~YesOrNo.tmp>nul

if not exist %temp%\~YesOrNo.tmp goto Yes

Echo Selected "No"

del %temp%\~YesOrNo.tmp

goto end

:Yes

Echo Selected "Yes"

Geez, but that looks overly complicated.

Tried the SET /P command?

Link to comment
Share on other sites

from a thread i created awile ago...

@echo off

TITLE

:start

set /p userinp=whatever y/n??

set userinp=%userinp:~0,1%

if "%userinp%"=="Y" goto yes

if "%userinp%"=="y" goto yes

if "%userinp%"=="N" goto no

if "%userinp%"=="n" goto no

echo invalid choice

goto start

:yes

do something

goto end

:no

do something else

goto end

:end

exit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...