how to execute arp commands in loop batch file

December 5, 2012 at 03:31:19
Specs: Windows 8
Hi..

I want to run a loop batch file for "arp -a" and "arp -d" with a delay of 3 seconds in between the two commands.

Someone suggested me to use the below batch file to execute but its not working. Its executing "arp -a" command continously without any delay.

:Begin
arp -a
sleep 3
arp -d
goto begin

Can anyone pls help me in solving this.


See More: how to execute arp commands in loop batch file

Report •


#1
December 5, 2012 at 03:43:00
:LOOP
arp -a
ping 1.0.0.0 -n 1 -w 3000 > nul
arp -d
ping 1.0.0.0 -n 1 -w 3000 > nul
goto :LOOP

Report •

#2
December 5, 2012 at 04:14:10
In the above case, only "arp -a" command get executes in loop and also its not showing any output. "arp -d" command not get execute.

Report •

#3
December 5, 2012 at 05:32:16
I think it has to have either an ip address, or if you want all host deletion, an *

arp -d *

:: mike


Report •

Related Solutions

#4
December 5, 2012 at 08:59:29
No output from arp -a means no current ARP entries by interrogating the protocol data. So the arp -d has no meaning at all. By the way mikelinus is right: an IP address is needed for the -d switch. I assure the ping command works fine by timing the loop.

Report •

#5
December 6, 2012 at 19:13:19
arp -d does not need an IP address. You can pass it an IP address or MAC address to remove a single entry but it's optional, and will clear the ARP cache if not given a specific interface to remove.

Tony


Report •

#6
December 7, 2012 at 07:10:09
sorry tony, I was reading the xp notes, and they claimed to clear the whole thing needed a *. I am assuming that has changed. :)

:: mike


Report •


Ask Question