Executing a command with options

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am trying to execute a command with options in a VB Script. I am using the
exec method because I want to look at stdout and stderr.

Executing from the command line it looks like this:
d:\HP OpenView\bin\opcragt -status -all

Here is the code I am using:

set shObj = CreateObject("WScript.Shell")
set ragtCmd = shObj.Exec ("d:\HP OpenView\bin\opcragt.cmd")
WScript.Echo ragtCmd.StdErr.ReadAll
WScript.Echo ragtCmd.StdOut.ReadAll

The proir code completes successfully, however when I add options to the
execution such as
set ragtCmd = shObj.Exec ("d:\HP OpenView\bin\opcragt.cmd -status -all")
or
set ragtCmd = shObj.Exec ("d:\HP OpenView\bin\opcragt.cmd /-status /-all")
or
set ragtCmd = shObj.Exec ("d:\HP OpenView\bin\opcragt.cmd /status /all")

stdout reports " 'd:\HP' is not a recognized as an internal or external
command, operable program or batch file."

Any ideas on what is happening and how to correct it?
.



Relevant Pages

  • Reading stuff piped to my program
    ... If I have a rexx program called "thing" that runs when I execute the "thing" command in my Windows XP, what code should I use inside "thing" to read the data piped to "thing" when I issue the command: ... Just in case I get this working, let me predict my next question: Do I need to do anything to pass data to a subsequent stage in a pipeline other than writing to STDOUT? ...
    (comp.lang.rexx)
  • Re: system command
    ... > execute the command and return the stdout in result. ... > know the trick, please let me know. ...
    (comp.lang.cpp)
  • system command
    ... Bascially, "System" shell out and ... execute the command and return the stdout in result. ...
    (comp.lang.cpp)
  • select.select() on windows
    ... I am currently using subprocess to execute a command. ... this is hanging on a read..waiting for more ... Except I don't have a socket, i have stdout. ...
    (comp.lang.python)
  • [Full-Disclosure] Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
    (Full-Disclosure)