Description: |
call:getHostName ip ret |
Dependencies: |
:getIP |
Script: |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.
|
:getHostName ip ret -- resolves IP address to computer name
:: -- ip [in,opt] - ip, default is THIS computer's IP
:: -- ret [out,opt] - computer name
:$created 20060101 :$changed 20080219 :$categories Network
:$source https://www.dostips.com
SETLOCAL
set ip=%~1
if "%ip%"=="" call:getIP "" ip
set name=
for /f "tokens=2" %%a in ('"ping /a /n 1 %ip%|find "Pinging" 2>NUL"') do set name=%%a
ENDLOCAL & IF "%~2" NEQ "" (SET %~2=%name%) ELSE (echo.%name%)
EXIT /b
|
|