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%)
You can open up a new command prompt window and issue whatever adb commands you want. They would work.
You can also put scrcpy in background if you want to use the same command prompt window to do something else there. Head over to Superuser to know more about this.
My post is more a comment than an answer (but I cannot comment).
All my comments below address only the case of Windows adb host.
adb shell gzip >C:\test.gz <C:\test.txt probably works just because the input file is a text file.
adb shell gzip >C:\test.gz <C:\test.bin fails because the call of Windows read function in adb stops reading as soon as ...
Sorry but it seems Kevin Beaumont from Microsoft has no clue what he is talking about. Mythbusters would proof him wrong..
It is completely unauthenticated, meaning anybody can connect to a device
That is simply not true. Even on rooted android TV boxes (where the adb miner supposed to run) one still must have access to home network (which is not possible ...
Late as I am to the party the following might be of some help:-
The command svc usb setFunction <mtp|ptp|rndis|midi> is the most likely candidate (alternatively setFunctions is used dependant on the version of Android.
I have resolved this issue by changing the APN in mobile. Go to your cellular network -> choose new APN with the same configuration of your selected one or create new APN with the same configuration of current one.
I uninstalled the package "com.google.android.partnersetup" when I was going to uninstall other app. I couldn't recover it with Bo Lawson's method. Instead i found this way:
pm dump com.google.android.partnersetup | grep Path
This give us some paths. One of them is the one I'm going to use: