Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to know if someone is online on the same network using ICMP requests.

Being able to ping another workstation on the network to see if its currently on.

A batch file with if and then statements, if 100% packet loss then says user is unavailable. if ping was successful then user is available.

I'm not sure how to go about with this batch file.

share|improve this question

1 Answer 1

Like this:

setlocal EnableDelayedExpansion

set IP=...
for /f "delims=() tokens=2" %%a in ('ping %IP% ^| find "% loss"') do (
  set loss=%%a
  set loss=!loss:% loss=!
  if !loss! equ 100 (
    echo %IP% is unavailable
  ) else (
    echo %IP% is available
  )
)

endlocal
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.