I want to make a CMD batch file that uses user input to ping a IP.
I also want to integrate the feature of using user input to ping an IP Address into a menu so that you can choose weather you want to ping the IP Address only 4 times or endlessly.
I want to make a CMD batch file that uses user input to ping a IP.
I also want to integrate the feature of using user input to ping an IP Address into a menu so that you can choose weather you want to ping the IP Address only 4 times or endlessly.
Here is a basic script that will allow the user to input the IP they wish to PING. After the script runs, it will pause then loop back to user input again. Furthermore, the script will detect if a host exist's or not, prompt the user, then loop back to user input.
The command your looking for is SET
with a syntax of SET [variable=[string]]
The gate /P
is Prompt For Input
. This will allow the script to "ask" you something then can prompt it via the %variable%
.
@ECHO OFF
:PING
cls & set /p adress=Type an adress you wish to ping:
cls
ping %adress% & echo. & pause. & goto :PING