batch file - Getting ip adress on win 7 and XP -


I need a batch file to detect that the IP address is empty or unavailable. Sometimes the batch file will run on Windows 7 and occasionally on Windows XP. So I need this kind of output.

If missing or not empty "Your IP% ip%, everything is OK

If missing or empty" Error IP not found "

 < Code> connection-specific DNS suffix .: Dxtnxx.naits.local IP address; ...:: 11.73.11.111 subnet mask: 255.255.254.0 IP address: ... ...: fe80 :: 21b: 77ff: Fake 3: F5 9% 5 Default gateway ... ...: 10.11.11.1    

Try it:

  @echo off & setlocal / F" tokens = 2delims = [] "%% ('Ping-N1 -4% Computam% ^ | Search / I "% computername% ') set" ip = %% a "if"% ip% " == "127.0.0.1" set "ip =" If not defined IP (resonance error IP not found) other echo. Your IP is% ip%, everything is OK Endlocal    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -