Hey anyone viewing this! So, I'm having a problem with some Batch code that I have been writing (see below). I'm trying to make an all around desktop assistant that's easy to use and simple. But that's not my problem. The problem is focused around the "define" feature of the program. Whenever testing the file, I can get all of the current definitions up to AB, but then the list cuts off (see representation of output). The space where the definitions should be are blank. Also, keep in mind that I know this isn't practical, but I want the code to be as simple as possible.
@echo off
:processes
color 0a
title Kapua, Your Virtual Assistant
cd ./Info
set /p name=<name.txt
set /p food=<food.txt
set /p color=<color.txt
set /p game=<game.txt
set /p friend=<friend.txt
set /p movie=<movie.txt
:start
cls
echo.
echo Kapua, Your Virtual Assistant
echo.
pause
goto welcome
:welcome
cls
echo.
echo Welcome, %name%!
echo.
pause
cls
goto main
:main
echo.
echo Enter a command.
echo Type "help" for all commands.
echo.
goto line
:line
set /p command=">"
if not defined command (
echo.
echo Pardon?
echo.
set command=
goto line
)
if %command% == help (
set command=
goto help
)
if %command% == define (
set command=
goto define
)
if %command% == clear (
set command=
goto clear
)
:help
echo.
echo Current available commands and functions:
echo.
echo "help" - displays the current available commands and functions
echo "define" - defines a word
echo "clear" - clears the current screen
echo.
goto line
:clear
cls
echo.
goto line
:define
echo.
echo Please type the word you want defined below.
echo Please use proper capitalization and punctuation! (Example: don't,
echo Aphrodite, et cetera)
echo For abbreviations, such as U.S.A. or E.U., don't include periods!
echo (Example: USA)
echo.
set /p word=">"
if not defined word (
echo.
echo Pardon?
set word=
goto define
)
if %word% == a (
echo.
echo Noun: 1. the first letter of the alphabet
echo.
echo Indefinite Article/Adjective: 1. one; one sort of
echo 2. each; any one
echo.
echo Prefix: 1. in, into, on, at, to
echo 2. in the act or state of
echo 3. up, out
echo 4. off, of
echo 5. not, without
echo.
echo *Used before words beginning with a consonant sound
echo.
set word=
goto line
)
if %word% == A (
echo.
echo Noun: 1. a blood type
echo 2. a grade indicating excellence
echo 3. the sixth tone in the scale of C major
echo.
set word=
goto line
)
if %word% == AA (
echo.
echo Abbreviation: 1. Alcoholics Anonymous
echo 2. Associate in/of Arts
echo.
set word=
goto line
)
if %word% == aardvark (
echo.
echo Noun: 1. a nocturnal, ant-eating African mammal
echo.
set word=
goto line
)
if %word% == Aaron (
echo.
echo Noun: the first high priest of the Hebrews
cho.
set word=
goto line
)
if %word% == AB (
echo.
echo Noun: 1. a blood type
echo.
echo Abbreviation: 1.Bachelor of Arts
echo 2. Alberta (Canada)
echo.
set word=
goto line
)
if %word% == ab (
echo.
echo Prefix: 1. away, from, from off, down
echo.
set word=
goto line
)
if %word% == ABA (
echo.
echo Abbreviation: 1. American Bar Association
echo.
set word=
goto line
)
if %word% == aback (
echo.
echo Adverb: 1. backward, back
echo.
set word=
goto line
)
if %word% == abacus (
echo.
echo Noun: 1. a frame with sliding beads for doing arithmetic
echo.
echo Plural: 1. abacuses
echo 2. abaci
echo.
set word=
goto line
)
if %word% == abaft (
echo.
echo Adverb: 1. in or behind the stern of a ship
echo.
echo Preposition: 1. nearer the stern than; behind
echo.
set word=
goto line
)
if %word% == abalone (
echo.
echo Noun: 1. an edible sea mollusk with an oval, somewhat spiral shell
echo.
set word=
goto line
)
Output (for the sake of variables I just substituted random stuff):
Kapua, Your Virtual Assistant
Press any key to continue...
(screen clears)
Welcome, Tom!
Press any key to continue...
(screen clears)
Enter a command. Type "help" for all commands.
define
Please type the word you want defined below. Please use proper capitalization and punctuation! (Example: don't, Aphrodite, et cetera) For abbreviations, such as U.S.A. or E.U., don't include periods! (Example: USA)
aardvark
Noun:1 a nocturnal, ant-eating African mammal
define
(Same thing as above)
ABA
>
So, can anyone help me solve this? Thanks!
Aucun commentaire:
Enregistrer un commentaire