comand promt script help

mike1996

Reputable
Apr 6, 2014
343
0
4,860
trying to wright a script to ask for ip and ping it but this one dose not ping just asks for ip infinitely

WHAT DID I SCREW UP, please help im new to scripting in command prompt

@echo off
title Ping
:start
echo what IP would you like to ping
set /p ip=
ping %ip%
Pause
goto start
 
Solution
If you haven't sorted your script yet, the variable id was being assigned the ip address but the script was still trying to ping the variable ip:

@echo off
title Ping
:start
set /p ip="What IP would you like to ping?":
ping %ip%
Pause
goto start

mike1996

Reputable
Apr 6, 2014
343
0
4,860


it keeps skipping over the actual ping command.
it will ask for the ip and then it will print out the ping usage info but it never actually pings anything
 

mike1996

Reputable
Apr 6, 2014
343
0
4,860


YES it worked thanks a lot started to think i wasn't going to get an answer back on this one

update:this works on windows 7 fine but not in windows 10 :(