Saturday, December 29, 2018

Why does the ping command in my batch file execute in a loop and navigates to the beginning?

I created a .BAT file in Windows 10 that has the following lines:


set /p ipadress="Please select your favourite IP-adress."
echo %ipadress%
ping %ipadress% -n 10

However, when I navigate on this batch file to ping, I can see the ping command repeatedly being executed in a loop. I even tried to rename the ping.BAT to ping.CMD but the result is the same.


It works until the second line. After repeating the selected IP address, it ends in a loop and jumps to the beginning of my batch file.


output


I want to avoid writing ping command through the command prompt, which is why I created the batch file. I don't know why the ping command is being continuously called when the same statement is put in a batch file.


Do you have any ideas?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...