Name: Anonymous 2009-03-27 17:51
@echo off
:start
echo.
echo Computer: Which topic do you wish to talk about?
set /p topic=
if %topic%.==. (echo Computer: Don't just press enter without typing anything!) && (echo I'll ask again.) && (goto start)
FINDSTR /C:"%topic%" responses.bat > NUL || goto unfamiliar
call responses.bat
----------------------------
So that's the start of my code. I'm trying to check for a null string, to make it complain if you just press enter without inputting anything.
It works for just pressing enter - but there's an unfortunate side-effect. If you enter in anything with a space (such as "James bond" , without quotes), it exits. It's not following goto end or anything like that, because I have a pause command right after :end.
I know it's definitely the line with the 'if' that's causing the problems, and not any other line. I think.
Help a noob out?
:start
echo.
echo Computer: Which topic do you wish to talk about?
set /p topic=
if %topic%.==. (echo Computer: Don't just press enter without typing anything!) && (echo I'll ask again.) && (goto start)
FINDSTR /C:"%topic%" responses.bat > NUL || goto unfamiliar
call responses.bat
----------------------------
So that's the start of my code. I'm trying to check for a null string, to make it complain if you just press enter without inputting anything.
It works for just pressing enter - but there's an unfortunate side-effect. If you enter in anything with a space (such as "James bond" , without quotes), it exits. It's not following goto end or anything like that, because I have a pause command right after :end.
I know it's definitely the line with the 'if' that's causing the problems, and not any other line. I think.
Help a noob out?