The specific steps are as follows: the IP address segment is 192.168.1.1-192.168.1.254, the mask is 255.255.255.0, And the gateway is 192.168.1.255. After the batch processing command is executed, set the IP address to 192.168.1.1. After the delay is 5 minutes, set the IP address to 192.168.1.2, and set it to 192.168.1.3 after 5 minutes of delay ...... similarly, when the IP address is set to 192.168.1.254, return to 192.168.1.1 and start to set it. If the batch processing file is not closed, it will continue to loop ...... step 1: Save the following code as E:/ipchange. bat
For/F "usebackq delims =: tokens = 2" % I in ('"ipconfig | find" ip address ""') do set ipaddr = % I
For/F "delims =. tokens = 1, 2, 4 * "% I in (" % ipaddr % ") do set/A ipaddr1 = % I & set/A ipaddr2 = % J & set/A ipaddr3 = % K & set/A ipaddr4 = % L
Set/A ipaddr4 = % ipaddr4 % + 1
If % ipaddr4 % = 255 (netsh interface IP Set address name = "Local Connection" Source = static ADDR = 192.168.1.2 mask = 255.255.255.0 gateway = 192.168.1.1 gwmetric = 1) else netsh interface IP Set addres name = "Local Connection" Source = static ADDR = 192.168.1.% ipaddr4 % mask = 255.255.255.0 gateway = 192.168.1.1 gwmetric = 1
Step 2: Use a scheduled task to call E:/ipchange. BAT and save the following code as. BAT:
@ Echo off
Setlocal enabledelayedexpansion
Set DO = E:/ipchange. bat
Set M = 5
Sets S = 9999
Set Time = % time :~ 0, 8%
Set Time = % time: = %
Set a = % time :~ 0, 2%
Set B = % time :~ 2,2%
Set c = % time :~ -2%
Set num = 0
: Top
Set d =! B!
If "% B :~ 0, 1% "=" 0 "Set B = % B :~ 1, 1%
Set/a B + = % m %
If % B % equ 60 (
Set d = 00
Set/A + = 1
Echo! A! :! D !.! C!
If not "! Do! "=" N "(if! S! Gtr! Num! (! A! :! D !.! C! /Interactive! Do !))
Set/a num + = 1
If! Num! Equ! S! Pause & Goto: EOF
Set B =! D!
Goto top
)
If % B % gtr 60 (
Set E =! B!
Set/a B/= 60
Set/A + =! B!
Set/a d =! E! -60 *! B!
If "! D :~ 1, 1! "=" "Set D = 0! D!
Echo! A! :! D !.! C!
If not "! Do! "=" N "(if! S! Gtr! Num! (! A! :! D !.! C! /Interactive! Do !))
Set/a num + = 1
If! Num! Equ! S! Pause & Goto: EOF
Set B =! D!
Goto top
Goto: EOF
) Else (
If "! B :~ 1, 1! "=" "Set B = 0! B!
Echo! A! :! B !.! C!
If not "! Do! "=" N "(if! S! Gtr! Num! (! A! :! B !.! C! /Interactive! Do !))
Set/a num + = 1
If! Num! Equ! S! Pause & Goto: EOF
Goto top
Goto: EOF
)
Program description:
1. Your system scheduled task must be enabled (enabled by default)
2. If you do not want to change the IP address, run at/delete/y.