ADB wireless :- problem with IP I use adb wireless tcpip connection but every time I connect my device to my router it assigns a new IP address to my android device which requires me to plug my phone again and restart adb in tcpip with the IP address provided, I dont want this to happen every time, I just want to enter the same IP address and put adb connect &lt;ipaddress&gt;:&lt;tcpip_port&gt; and connect to my device.
i tried to use static IP for the network using the mobile but due to some reason this restricted me to use  internet(it was connected to the modem but not able to use internet).
More info:
Android 10
MIUI 12
redmi note 7s
i use scrcpy and have created a bat file(.cmd file) which when clicked runs a series of commands to connect to my phone wirelessly using adb and mirror the screen and control it remotely but because my router assigns a different IP ever time i connect my phone i have to edit the bat file.
Even if I type the commands manually without connecting the device with USB cable (adb connect &lt;ipaddress&gt;:&lt;tcpip_port&gt;) it says: unable to connect to &lt;ip addr&gt;:5555: cannot connect to &lt;ip addr&gt;:5555: No connection could be made because the target machine actively refused it. (10061) , then i have to connect it with USB cable and again start the adb in tcpip.
What is the use of adb wireless connection if I have to connect it to pc by USB every time (at the beggining) to make it wireless for that specific time.
IP address is not the problem here. reason is your phone is unrooted therefore the wireless app is unable to start adbd. so you have to plug in usb cable each time and switch to wireless regardless of IP address. This is fixed in android 11
however, regarding your IP issue you can use hostname instead (it is hard-coded here in %device%)

@echo off
setlocal enabledelayedexpansion

set device=android-6cf1b33d5e54da8d

for /F &quot;delims=[] tokens=2&quot; %%f in ('ping -n 1 -w 1000 -4 !device!') do (
  set client=%%f
  echo %%f | findstr /r /c:&quot;\&lt;[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\&gt;&quot; &gt; NUL 2&gt;&amp;1 &amp;&amp; goto connect
)
echo !device! device not found
pause
goto end
:connect
adb connect !client!:5555
scrcpy -s !client!:5555
:end