• Happy holidays, folks! Thanks to each and every one of you for being part of the Tom's Hardware community!

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


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
 


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 🙁