Solved Choice command for batch fille unable to run windows 7 64bit

May 9, 2016 at 03:31:09
Specs: Windows 7
echo off
path e:\rework\
cls
type a.txt
choice Input Selection /c:12X
if errorlevel 3 goto end
if errorlevel 2 goto FCT
if errorlevel 1 goto ICT

:ICT
ICT.bat
goto end:

:FCT
FCT.bat
goto end:

:end


See More: Choice command for batch fille unable to run windows 7 64bit

Report •


✔ Best Answer
May 19, 2016 at 11:30:33
RainBawZ, you might want to check the command's help before you call out a particular syntax as invalid:

C:\>if /?
Performs conditional processing in batch programs.

IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command

  NOT               Specifies that Windows should carry out
                    the command only if the condition is false.

  ERRORLEVEL number Specifies a true condition if the last program run
                    returned an exit code equal to or greater than the number
                    specified.

  string1==string2  Specifies a true condition if the specified text strings
                    match.

  EXIST filename    Specifies a true condition if the specified filename
                    exists.

  command           Specifies the command to carry out if the condition is
                    met.  Command can be followed by ELSE command which
                    will execute the command after the ELSE keyword if the
                    specified condition is FALSE

How To Ask Questions The Smart Way



#1
May 9, 2016 at 03:54:33
Your syntax is wrong. You probably want:

choice /M "Input Selection" /c:12X

message edited by ijack


Report •

#2
May 9, 2016 at 08:50:24
Are we meant to guess what's wrong?

=====================

M2 Get custom script or take private lessons


Report •

#3
May 19, 2016 at 02:44:42
In addition to what ijack said about the CHOICE syntax, you're also not using the correct IF syntax.

choice /m "Input Selection" /c 12x
if %errorlevel%==1 goto ICT
if %errorlevel%==2 goto FCT
if %errorlevel%==3 goto end

Don't worry if plan A fails, there are 25 more letters in the alphabet ;)


Report •

Related Solutions

#4
May 19, 2016 at 11:30:33
✔ Best Answer
RainBawZ, you might want to check the command's help before you call out a particular syntax as invalid:

C:\>if /?
Performs conditional processing in batch programs.

IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command

  NOT               Specifies that Windows should carry out
                    the command only if the condition is false.

  ERRORLEVEL number Specifies a true condition if the last program run
                    returned an exit code equal to or greater than the number
                    specified.

  string1==string2  Specifies a true condition if the specified text strings
                    match.

  EXIST filename    Specifies a true condition if the specified filename
                    exists.

  command           Specifies the command to carry out if the condition is
                    met.  Command can be followed by ELSE command which
                    will execute the command after the ELSE keyword if the
                    specified condition is FALSE

How To Ask Questions The Smart Way


Report •

#5
May 19, 2016 at 21:30:29
I guess we ARE sposta guess.

LOL

While I've got you on the horn...

You can avoid a bunch of clutter by losing all the IF mess.

CHOICE bla bla

call :!errorlevel!

=====================

M2 Get custom script or take private lessons


Report •


Ask Question