This seems like a really easy question (running Windows 7). But I have looked for the answer and couldn't find anything at Microsoft's sites (XP PING & Everything else PING) or from a bunch of Google searches.
I am learning DOS/Batch file. My beginning code is to PING a server.
If I enter this in the command prompt it runs fine, and gives me some results
PING -n 1 Server04
Pinging Server04.aaaa.xxxx.net [x.x.x.x] with 32 bytes of data: Reply from x.x.x.x: bytes=32 time=1ms TTL=125
If I run this in a batch file, it never stops, but the -n (or /n) should only send the PING once, and the PAUSE should also stop and hold the cmd.exe window open.
PING -n 1 winsvmnsdev04 PAUSE
C:\Users\Me\Desktop>PING -n 1 Server04 C:\Users\Me\Desktop>PING -n 1 Server04 C:\Users\Me\Desktop>PING -n 1 Server04 Continues until I use Ctrl + C
I have looked at a bunch of Q&A where many include 'errorlevel' to echo the response and some that have a trailing '> null'. In trying to understand, I have looked and neither of these are listed as attributes of 'PING' in the Microsoft Libraries.
When I run
PING -n 1 winsvmnsdev04 > null PAUSE
PING -n 1 winsvmnsdev04 > null
I get one line
C:\Users\Me\Desktop>PING -n 1 Server04 1>null
I have no idea why. Can someone explain these two attributes of PING, or point towards the official documents?
-n don't not limit to one PING, the
>null and the
PAUSE don't work when the PING is running wild. None of these line up with what the Microsoft Documentation is describing.
errorlevel is not listed as Command-Line Reference by Microsoft