Question

Locked

Problems with PING in BATCH files

By day1118 ·
Hi all, Trying to make a simple batch file that will ping a computer, and display the results. So far I have

@Echo off
Echo Test if 192.168.2.1 is available
Ping -n 1 192.168.2.1
@Pause
Exit

It is saved in a file called Ping.bat. If i run the file, it displays 'Test if 192.168.2.1 is available' then just sits there.

But if I open up command prompt and then run the file through it, it works perfectly!

Any suggestions of what could be wrong?

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Rename the Batch File

by Bizzo In reply to Problems with PING in BAT ...

Rename the batch file to something other than ping.bat, as it may be trying to call itself, rather than ping.exe.

Collapse -

No luck

by day1118 In reply to Rename the Batch File

Thanks, but the file was already named ping1 or ping2 as I changed my code, and making the name completely different made no difference.

Thanks anyway.

Collapse -

Bizzo is right name it anything except a start of command name

by IC-IT In reply to No luck

Rename it to TestPing.bat
Weirdest thing, but it was fun to test.

Collapse -

What OS?

by Bizzo In reply to No luck

I'm testing this under XP Pro and it seems to be working fine for me.

Instead of Ping -n ... in the batch file, use ping.exe -n ..., as it still may be picking up an old ping.bat.

If that doesn't work, try putting the absolute pathname to ping.exe
i.e. %windir%\system32\Ping.exe -n ...

If that doens't work either, try remarking out the @Echo off and seeing if it gives any clue as to why it's failing.

Collapse -

SIMPLE AS THAT

by bojler In reply to What OS?

put in your batch file line like that
ping.exe 192.168.100.2 -t
that will work for sure
ofcourse you can type any ip adress you want

Back to Desktop Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums