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
1
solved Make a batch file that uses user input to ping an IP Address with a menu [closed]