How to create a simple .bat ping script

How to create a ping script using a .bat file, you can use the PING command in Windows, followed by the IP address or hostname you want to ping. Here is an example of a simple ping script in a .bat file:

@echo off
echo Enter the IP or hostname you want to ping:
set /p IP=
ping %IP%
pause
BAT

Than save the file with a .bat extension, such as ping.bat. To run the script, open a the .bat file.
The script will prompt you to enter the IP or hostname you want to ping, For example localhost or 192.168.0.1 and then hit enter, this will execute the ping command using the input you provided.

This is just a simple example of how to create a ping script using a .bat file. You can modify the script to add additional functionality, such as allowing the user to specify the number of ping requests to send, or the timeout value. You can also add error handling to handle cases where the ping fails or the IP address or hostname is invalid.

Author: reecewheeler

Leave a Reply

Your email address will not be published. Required fields are marked *