Re: run external program, get return code



Jay schrieb:
I am familar with WshShell.Exec and WhShell.Run. Basically I want to use the MS portqry tool, which according to its docs, has a quiet mode:

"-q 'quiet' operation runs with no output
returns 0 if port is listening
returns 1 if port is not listening
returns 2 if port is listening or filtered"

I'd like to get a simple VBS to run portqry and read the return value.

thoughts?

If you are familiar with .Run and .Exec, you probably know about

the bWaitOnReturn parameter to .Run

Optional. Boolean value indicating whether the script should wait for
the program to finish executing before continuing to the next
statement in your script. If set to true, script execution halts until
the program finishes, and Run returns any error code returned by the
program. If set to false (the default), the Run method returns
immediately after starting the program, automatically returning 0 (not
to be interpreted as an error code).

and the ExitCode property of the WShell object

Executables set an exit code when they finish running. This conveys
the status information when a process ends. Often, it is used to send
an error code (or some other piece of information) back to the caller.
If the process has not finished, the ExitCode property returns 0. The
values returned from ExitCode depend on the application that was
called.
.



Relevant Pages

  • run external program, get return code
    ... Basically I want to use the MS portqry tool, which according to its docs, has a quiet mode: ... returns 1 if port is not listening ...
    (microsoft.public.scripting.wsh)
  • Attempted install of an Obj-C Foundation library
    ... I am trying to get a working Objective-C Foundation library on FreeBSD amd64 ... Objective-C code from Mac OS X - and not having any success. ... I first tried a default install of the gnustep-base port but got this: ... *** Error code 1 ...
    (comp.unix.bsd.freebsd.misc)
  • Cups cant start with error 98
    ... startup, with error code 98: ... That was fair enough the first time, ... and found nothing is bound to port 631. ... so I stopped the nfs processes. ...
    (Debian-User)
  • Re: coredll CreateFile on serial port
    ... > Before leaving the thread can yopu advise the reference you used to fin ... > error code 183? ... The port can only be used by one process at a time. ...
    (microsoft.public.dotnet.framework.compactframework)
  • whats wrong with my ports???
    ... This problem has been recurring on my laptop for the ... Very frequently, I'll go to portinstall something, and I'll get several ... can successfully build whatever port I was trying at the time. ... *** Error code 1 ...
    (freebsd-questions)