0

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?

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

1 Answer 1

1

From set /?:

SET /P variable=[promptString]

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

So:

echo Please enter the IP Address to TELNET 
set /p IP_Addr=IP Address: 
3
  • Perfect, exactly what I was missing. Thanks!
    – Mike
    Jul 14, 2016 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. ;) Jul 14, 2016 at 19:24
  • Excellent, I will give it a try!
    – Mike
    Jul 14, 2016 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .