Note: The red section may be modified as needed
Yourtestpcname is the name of the computer you need to test.
The red number is partly related to the IP address of the environment.
Copy the following code to the bat file.
for/f "tokens=2 delims=["%%i in (' Ping%pcname% -4^|findstr '%pcname% ') do set ip=%%i
if/i "%lastchar%" = "]" (set iptmp=%ip:~0,13%)