What is wrong with this code for a batch file i am trying to make?

I am trying to make it so you may search any cardinals player and it tells you their batting average. what is wrong with it?

Here it is...

@echo off

color c

cls

:index

echo.

echo type in any Cardinals Player to see their Batting Average!!

echo please type in a valid 2012 player.

set /p input=(make sure he's from 2012)

if %input% == Shane Robinson goto a

if %input% == Lance Lynn goto b

if %input% == David Freese goto :c

if %input% == Rafael Furcal goto d

if %input% == Jon Jay goto e

if %input% == Lance Berkman goto f

if %input% == Carlos Beltran goto g

if %input% == Jamie Garcia goto h

if %input% == Matt Carpenter goto i

if %input% == Yadier Molina goto j

if %input% == Erik Komatsu goto k

if %input% == Matt Holiday goto l

if %input% == Jake Westbrook goto m

if %input% == Daniel Descalso goto n

if %input% == Tyler Greene goto o

if %input% == Tony Cruz goto p

if %input% == Kyle Lohse goto q

if %input% == Adam Wainwright r

if %input% == J.C. Romero goto s

if %input% == Kyle McClellan goto t

if %input% == Victor Marte goto u

if %input% == Fernando Salas goto v

if %input% == Mitchell Boggs goto w

if %input% == Jason Motte goto x

if %input% == Marc Rzepczynski goto y

if %input% is not a valid (answer/command). please check you're spelling

echo.

goto start

:a

echo .400

goto end

:b

echo .400

goto end

:c

echo.

echo 375

goto end

:d

echo .364

goto end

:e

echo .349

goto end

:f

echo .348

goto end

:g

echo .333

goto end

:h

echo .333

goto end

:i

echo .321

goto end

:j

echo .317

goto end

:k

echo .273

goto end

:l

echo .203

goto end

:m

echo .200

goto end

:n

echo .194

goto end

:o

echo .192

goto end

:p

echo .111

goto end

:q

echo .000

goto end

:r

echo .000

goto end

:s

echo .000

goto end

:t

echo .000

goto end

:u

echo .000

goto end

:v

echo .000

goto end

:w

echo .000

goto end

:x

echo .000

goto end

:y

echo .000

goto end

:end

pause

exit

2 Answers

Relevance
  • 8 years ago
    Best Answer

    If you want to compare things with spaces in them, you need to put quotes around everything:

    if "%input%" == "Shane Robinson" goto a

    Note that there are quotes on BOTH sides of the ==.

  • 3 years ago

    What scripting language are you employing? i'd think of of of starting to be a loop around your good judgment the region the contents are written into the rfile. for each loop, furnish the output to a variable alongside with log$x.txt the region $x gets incremented with the help of ability of a million each and each and each and every time. ensure which you do % up the rfile interior the journey that your language calls which you will close information that are opened.

Still have questions? Get your answers by asking now.