This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 19th, 2013  |  syntax: None  |  size: 0.55 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Envoi d'une requête 'ping' sur XXXXXXXX.DOMAIN.NAME.com [127.0.0.1]
  2.        
  3. set hostname=
  4. for /f "skip=1 tokens=2" %%x in ('ping -n 1 -a so.me.i.p') do if not defined hostname set hostname=%x
  5. echo %hostname%
  6.        
  7. @ECHO OFF
  8. SETLOCAL
  9. FOR /f "delims=" %%i IN ('ping -n 1 -a 127.0.0.1^|find "["') DO CALL :sub %%i
  10. ECHO hostname: %hostname%
  11. ECHO domain: %domain%
  12. ECHO whole chebang: %chebang%
  13. GOTO :eof
  14.  
  15. :sub
  16. SET hostname=%2
  17. IF NOT %hostname:~0,1%==[ shift&GOTO sub
  18. SET chebang=%1
  19. FOR /f "tokens=1*delims=." %%a IN ("%1") DO SET hostname=%%a&SET domain=%%b
  20. GOTO :eof
clone this paste RAW Paste Data