Solved How do I use the /a variable?

April 4, 2015 at 18:42:51
Specs: Windows 8
I haven't used the /a command in such a long time and I need a little jogging of the memory.

What I am trying to do with this program is make a sort of AI chat, it will take simple commands like hello, and it will give them a corresponding answer, it will also kind of look like a normal chat with the previous text slowly moving up with every new piece of text.

I feel like I'm confusing the /a command with the /p command but I can't remember the proper way of using the /a


@echo off
:Chat
cls
title --(AI)--
echo ================================================================================
echo Artifical Intelligence
echo ================================================================================
echo.
echo. %chat_1%
echo.
echo. %chat_2%
echo.
echo. %chat_3%
echo.
set /a chat_3 = Type In Something...
goto Chat


See More: How do I use the /a variable?

Report •


#1
April 5, 2015 at 04:07:39
✔ Best Answer
To prompt for entering something you have to use the /P switch, e.g.

set /P input=Enter your name^>
echo.Hello %input%

while to perform arithmetic you have to code the /A switch, e.g.

set /P speed=Enter speed as miles/hour^>
set /P time=Enter how many hours you drive^>
set /A space= %speed% * %time%
echo.You are %space% miles far away.

Arithmetic is for integer numbers only, to know more type set /?

message edited by IVO


Report •

#2
April 5, 2015 at 13:55:38
Thanks, I'll write this down somewhere to remember it but what about this...

@echo off
:Chat
cls
title --(AI)--
echo ================================================================================
echo Artifical Intelligence
echo ================================================================================
echo.
echo. %chat_1%
echo.
echo. %chat_2%
echo.
echo. %chat_3%
echo.
set /P chat_3 = Type In Something...
goto Chat

I'm assuming you know how normal chats work with every new piece of chat slowly moving up until it can't be seen, and when I set the user input as chat_3 and reload the page shouldn't it show the user input right above the spot where you enter the text?

If I am not describing my predicament good enough for everyone to understand please tell me and ill try to shed some light on it


Report •
Related Solutions


Ask Question