ADB wireless :- problem with IP
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