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
Post a Comment