Thank you all for your answers and advice.
Due to your suggestions, I found this: Determine RDP Client IP Address
I think I will borrow this part to use in my script.
Code:

for /f "Tokens=2 Delims=[]" %i in ('ping -n 1 %CLIENTNAME%') do echo %i