Need CMD help!

December 28, 2011 at 05:10:47
Specs: Windows XP
I need help with CMD. I use Windows xp.
I'm making a 'chat-bot', wich answers questions etc.
But my problem is that cmd cant recognize sentences, only words. For exemple:

@echo off
set /p quiz01=
if %quiz01% EQU Who are you goto 'command'

But when you fill in Who are you, The cmd dissapears..
So.. Is there a way to let CMD recognize sentences?

(sorry for my bad english)

See More: Need CMD help!

Report •

December 28, 2011 at 06:52:09
It's because you have spaces. In your IF statement if you have spaces included in a sentence always use "quotes".

IF "%quiz01%"=="Who are you" Goto :command

Also, creating a chat-bot this way will be difficult. You will have to enter a lot of possible sentences if you wish to make it more realistic.

Report •

December 28, 2011 at 11:35:50
Thanks! Exactly what I needed.
Is there another way to make a chat-bot? Could you explain me that way or send me a link of a site where I can find that way? ;)
Again thanks

Report •

December 28, 2011 at 19:29:54
You could create one in a proper programming language like VB or C. You would be able to do much more, have visual boxes and click-able buttons for different things etc.

In batch it's pretty much doing what you're doing until you cover every sentence possible. Which would take forever!
It's probably possible to create a chat bot that learns from user input, or which can break down sentences into words and sort of work out specific questions or answers. But It would take probably hours of trying different ideas and code to do it.
Possibly a challenge for the future :)

Report •

Related Solutions

December 28, 2011 at 19:42:13
To be fair a chat bot will take quite a lot of work in any language, it's just that it will probably be much easier to express that work in languages other than batch.

Using "set /p" can be a little annoying, you may want to look at this:

Report •

December 29, 2011 at 05:03:28
Thanks :D I'm going to check out other options of programming, such as VB or C.

Report •

December 29, 2011 at 05:04:22
Thanks for the link! That could help me alot. ;)

Report •

Ask Question