Cannot seem to get this exactly right, trying to setup a batch file to do some network commands, such as ping. I have the following code:

echo Please enter the IP Address to TELNET 
echo IP Address:
set /p IP_Addr=

I can't seem to get the input for IP Address on the same line as the echo. I tried using echo|set, but don't know if I've used it correctly.

Any ideas?

  • Sorry, lost formatting when posted question. Each "echo" is on a different line, and "set" is on a different line. – Mike Jul 14 '16 at 19:14

From set /?:

SET /P variable=[promptString]

The prompt you want to display for the set /p goes after the equals sign.


echo Please enter the IP Address to TELNET 
set /p IP_Addr=IP Address: 
  • Perfect, exactly what I was missing. Thanks! – Mike Jul 14 '16 at 19:19
  • 1
    No problem. :) Note you can put a space after it too, and it'll include that space in the prompt (to put a gap between the colon and their input), so it looks nice. ;) – Ƭᴇcʜιᴇ007 Jul 14 '16 at 19:24
  • Excellent, I will give it a try! – Mike Jul 14 '16 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.