Re: Ping return code

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: guard (^T^S^G^n^e^w^s^_at_TheSystemGuard.com)
Date: 12/08/04

  • Next message: nospam.please_at_ualberta.ca: "Re: Ping return code"
    Date: Wed, 8 Dec 2004 15:05:38 -0500
    
    

    "Demis Gonçalves" wrote

    > Hi for all, on unix when i use the ping command and a machine returns with
    > time out the SO returns to me with the code 1, telling me that i hadn´t no
    > answer. On Windows if a computer returns with time out the windows returns
    > to me a return code 0. How do i do to got the correct return code of
    > Windows. I need a return code other 0 when a computer times out.
    >

    Try the FREE Mount/\Command called .Alive

    It is based on Ping.exe and works CONSISTENTLY
    across NT/2K/XP/K3.

    *******

    A frequent SysAdmin need is to check the accessibility of a remote
    system by using the native Ping utility. A new M^^C called .Alive
    provides a CONSISTENT self-documenting method to check one machine,
    a list of machines or an entire range of IP addresses.

    The variable which contains the input is called, of course, %Alive%.

    The scripting code is stored in variable %.Alive%.

    Since the input is expanded at runtime, you can set the input value
    and run the command within the same line of code! Delayed Variable
    Expansion is not necessary, allowing full compatibility across
    NT/2K/XP/K3. The self-documenting code looks like this:

       FOR /L %%A IN (1,1,254) DO @(
          (SET "Alive=10.7.7.%%A")
          (%.Alive%)
       )

    .Alive takes the internal Ping command up on Mount Knowledge!
    The code above will check the entire address range from
    10.7.7.1 through 10.7.7.254, reporting on each address in turn.

    But it get even better than that!

    Success is reported to STDOUT, failure is reported to STDERR.
    So, to see only the addresses that are active, suppress STDERR
    using the %.Kity% {Keep-It-To-Yourself] command.

       FOR /L %%A IN (1,1,254) DO @(
          (SET "Alive=10.7.7.%%A")
          (%.Alive% %.Kity%)
       )

    To see only the machines that are inaccessible,
    suppress STDOUT using the %.Quiet% command.

       FOR /L %%A IN (1,1,254) DO @(
          (SET "Alive=10.7.7.%%A")
          (%.Alive% %.Quiet%)
       )

    Additional examples are on the pre-release ".Alive Page" at
    (http://TheSystemGuard.com/MtCmds/CrystalClear/Alive.htm).

    There is also a link there to download the pre-release code
    and test it on your machine.

    To look up the syntax of any other "Mounted Commands"
    used in the examples, see the Master Catalog at
    (http://TheSystemGuard.com/MasterCatalog.asp).

    -tsg

    /-----------------+---------------+----------------------\
    | COMPATIBILITY | CLARITY | SPEED |
    | Write code ONCE | Make it clear | THEN...Make it fast! |
    \-----------------+---------------+----------------------/
    400+ command-line resources using ONLY native NT commands!
     (http://TheSystemGuard.com/default.asp#MasterCommandList)


  • Next message: nospam.please_at_ualberta.ca: "Re: Ping return code"

    Relevant Pages

    • RE: re-setting boot partition
      ... Description of the Windows 2000 Recovery Console ... For a Microsoft Windows XP version of this article, ... MB of hard disk space on your system partition to hold the Cmdcons folder ... Windows NTBoot Console Command Interpreter. ...
      (microsoft.public.win2000.setup_upgrade)
    • RE: Win2000 Upgrade to SP3 Express Setup error.
      ... Start your computer with the Windows Setup floppy disks, ... MB of hard disk space on your system partition to hold the Cmdcons folder ... Windows NTBoot Console Command Interpreter. ... you cannot copy a file from the local hard disk to a floppy disk. ...
      (microsoft.public.win2000.setup_upgrade)
    • RE: Locating corrupt driver
      ... This article describes the functionality and limitations of the Windows ... Create and format partitions on drives. ... MB of hard disk space on your system partition to hold the Cmdcons folder ... Windows NTBoot Console Command Interpreter. ...
      (microsoft.public.win2000.applications)
    • >>>> NET SEND <<<<
      ... Windows Xp Net Send ... Net Send Command For Mac ... Net Send Syntax Dos ... Dos Net Send Commands ...
      (sci.lang.japan)
    • Software Report [Windows Tips: Command Line Control - 08/03/2005]
      ... Windows Tips: Command Line Control ... Some of Windows' most useful tools don't have desktop icons. ... Stay awake at the switch: While the commands are useful by themselves, ... When your command acts on a file or folder (such ...
      (comp.sys.ibm.pc.misc)