Saved Bookmarks
| 1. |
Solve : geting remot computers name [plaese help]? |
|
Answer» How do i get the name of a remote COMPUTER??? How do i get the name of a remote computer??? some of the tools in WINDOWS that can be used are nbtstat (LAN), nslookup.. you can also find those GNU tools like dig that can query DNS and run them from windows ... i know i need to do this with a for loop but i can't quite figer out the for loops but i need it to return the name of the computer of the ip i set to a varable = name so it is like for nslookup %ip%|find /i name set = name but i need it only to select to ip when it does the find so if the name on ip = 135.1.65.7 test it would display test insted of name: test PLEASE HELP THINK YOU VERY MUCH can you try and see if this WORKS @echo off for /F "tokens=2 delims=: " %%i in ('nslookup %ip% ^| findstr /I name') do ( echo %%i set name=%%i )Or this: for /f "tokens=2" %%a in ('"ping /a /N 1 %ip%|find "Pinging""') do echo.%%a Quote can you try and see if this works ok now how do i make this not retun an error?? if the ip is not found :-? :-? :-? Perhaps place some ERRORLEVEL checking in there ? See attached list (it might help). for /f "tokens=2" %%a in ('"ping /a /n 1 %ip%|find "Pinging" [highlight]2>NUL[/highlight]"') do echo.%%a[/b] or @echo off for /F "tokens=2 delims=: " %%i in ('nslookup %ip% ^| findstr /I name [highlight]2>NUL[/highlight]') do ( echo %%i set name=%%i ) Like this? |
|