I am making chat room kind of thing in batch. Unfortunately the file fails to store variables. Here is my code
@echo off
color b
Title Messanger
:top
echo Are you hosting the chat?
set /p host="Yes or no>"
if /i "%host%"=="yes" (
    set /p port="Port>"
    rem This would normally listen for connections
    echo Listening for connections on port %port%
    pause
 )
if /i "%host%"=="no" (
    echo Who is hosting this chat?
    set /p ip="Ip>"
    set /p port="Port>"
    echo ----------------CHAT----------------
    rem This would normally connect to the ip and port
    echo %ip% %port%
 )
echo Error.
pause
goto top
I dont know if you get the same result but only see the message without the variables. OUTPUT:
Are you hosting the chat?
Yes or no>yes
Port>8080
Listening for connections on port
Press any key to continue . . .
After this it does as it should ad echos error and goes to the start of the file
 
    