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
-
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 ==.
Connor at Yahoo! Answers Visit the source
Related Q & A:
- How to run an interactive batch file on windows from a service?Best solution by Stack Overflow
- How do I make a video file smaller?Best solution by Yahoo! Answers
- Can some one tell me what the starting hourly rate is for a Postal Custodian? I live in the Tampa area?Best solution by Yahoo! Answers
- How to make a batch file copy itself?Best solution by Yahoo! Answers
- I'm trying to get a meeting with a diplomat to counsel me on a career in international affairs?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.