I can't solved my problem

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
xhai
Posts: 39
Joined: 13 Jun 2013 09:33

I can't solved my problem

#1 Post by xhai » 02 Sep 2014 07:48

Hi dear sir help fix my code!

Code: Select all

if "%skip%"=="Disable" (
   echo Skip CRC check and ISO verification : %skip%
   ) else (
   echo Skip CRC check and ISO verification : Enable
)
echo Do you want to process with this setting? Y(es) N(o)
echo ===============================================================================
echo.
set "option3="
set /P "option3="
if /i "%option3%"=="Y" (
  if "%skip%"=="Disable" (
  goto :abc
) else (
  goto :xyz
)
if /i "%option3%"=="N" (
   goto :Start
   )


I want the code to work like this. when I input "Y" it will check "skip" if it's disable and goto :abc, if not it will goto :xyz

Thank you

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: I can't solved my problem

#2 Post by foxidrive » 02 Sep 2014 07:57

Give this a try:

Code: Select all

if "%skip%"=="Disable" (
   echo Skip CRC check and ISO verification : %skip%
   ) else (
   echo Skip CRC check and ISO verification : Enable
)
echo Do you want to process with this setting? Y(es) N(o)
echo ===============================================================================
echo.
set "option3="
set /P "option3="
if /i "%option3%"=="Y" (if "%skip%"=="Disable" (goto :abc) else (goto :xyz) )
if /i "%option3%"=="N" (goto :Start)
goto :EOF

xhai
Posts: 39
Joined: 13 Jun 2013 09:33

Re: I can't solved my problem

#3 Post by xhai » 02 Sep 2014 08:59

foxidrive wrote:Give this a try:

Code: Select all

if "%skip%"=="Disable" (
   echo Skip CRC check and ISO verification : %skip%
   ) else (
   echo Skip CRC check and ISO verification : Enable
)
echo Do you want to process with this setting? Y(es) N(o)
echo ===============================================================================
echo.
set "option3="
set /P "option3="
if /i "%option3%"=="Y" (if "%skip%"=="Disable" (goto :abc) else (goto :xyz) )
if /i "%option3%"=="N" (goto :Start)
goto :EOF


Thanks foxi It work, What was the problem in my code?

ShadowThief
Expert
Posts: 1163
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: I can't solved my problem

#4 Post by ShadowThief » 02 Sep 2014 09:02

Looks like you were missing a )

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: I can't solved my problem

#5 Post by foxidrive » 02 Sep 2014 09:23

ShadowThief wrote:Looks like you were missing a )


Yes, above here

Code: Select all

if /i "%option3%"=="N" (
   goto :Start
   )

xhai
Posts: 39
Joined: 13 Jun 2013 09:33

Re: I can't solved my problem

#6 Post by xhai » 03 Sep 2014 00:12

thanks you foxidrive and ShadowThief for finding my mistake..

Post Reply