|
Answer» Hello! I am having trouble creating a BATCH chat box. You know.. when you can chat with your OWN COMPUTER!! :O ;d This is what i have done for now: echo off :startgame cls echo Hi wazup! Who are you? set /p name= echo OK, %name%! Say something! set /p chat= if %chat% == somehing echo something EH? So here is my trouble.. How can I make something like this: if %chat% NOT == somehing echo What? I didnt undestand.Ok i added something like this : goto :LOOP :LOOP set /p chat= IF "%chat%"=="" ( ECHO Nothing is entered GoTo :LOOP ) IF /I "%chat%"=="Hi" ( echo Hello Goto :loop
C:\test>type chat.bat echo off setlocal enabledelayedexpansion set chat=echo chat=%chat% :loop echo enter greeting? set /p chat= echo chat=%chat% IF "%chat%"=="" ( echo Nothing is entered goto :loop ) if "%chat%"=="HI" ( echo Hello set chat=goto :loop ) echo Hasta La Vista echo Do you want to stop(Y/N) echo Use UPPER case Y set /p ans= if %ans%==Y goto :end set chat=goto :loop :end echo Bye Output:
C:\test> chat.bat chat= enter greeting?
chat= Nothing is entered enter greeting? HI chat=HI Hello enter greeting? How are you? chat=How are you? Hasta La Vista Do you want to stop(Y/N) Use upper case Y n enter greeting? Good Morning chat=Good Morning Hasta La Vista Do you want to stop(Y/N) Use upper case Y Y Bye
C:\test>
|