jeudi 6 août 2015

CMD If == then set /p unexpect error ' '=='Y'

The batch works the first time but after I enter something into user input it shows the effect but when it goes back to the If /I %software% it messes up and flashes an error "An Unexpected error has occurred at this time"

:Start
:1
If /I %software% == Software1 Echo '**1. Software1 Install & goto :2
Echo ' 01 Adobe Reader DC    
:2
If /I %software% == Software2 Echo '**2. Software2 & goto :3
Echo ' 02 Adobe Flash Player    
:3
If /I %software% == Software3 Echo '**3. Software3 & goto :4
Echo ' 03 Adobe Shockwave    
:4
If /I %software% == Software4 Echo '**4. Software4 & goto :5
Echo ' 04 Oracle Java

When i type 4 it does popup with the "**" next to 4 but it won't register with the If statement This is where my problem is once it hits the first if /I choice=' install Software 1? it flashes the error message and closes the batch file

if /I '%software%' == 'Software1' set /p choice=' install Software 1?
if /I '%software%' == 'Software2' set /p choice=' install Software 2?
if /I '%software%' == 'Software3' set /p choice=' install Software 3?
if /I '%software%' == 'Software4' set /p choice=' install Software 4?
goto :options

:Options
if %choice% == Y goto Install%Software%
goto :Exit

:InstallSoftware1
:set Software=Software2
start Software1
goto :Start

:InstallSoftware2
:set Software=Software3
start Software2
goto :Start

:InstallSoftware3
:set Software=Software4
start Software3
goto :Start

:InstallSoftware4
:set Software=Software1
start Software4
goto :Exit

:Exit
Exit

any ideas?

Aucun commentaire:

Enregistrer un commentaire