Executing a command with options
- From: Warren <Warren@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Jan 2008 06:04:01 -0800
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?
.
- Follow-Ups:
- Re: Executing a command with options
- From: McKirahan
- Re: Executing a command with options
- From: Richard Mueller [MVP]
- Re: Executing a command with options
- Prev by Date: Re: formatting output to be sorted by largest size
- Next by Date: Re: If/Then statments to make a "pretty" version of the physical memory size - shouldn't this work?
- Previous by thread: Re: Help needed: ie.busy/readystate loading frame
- Next by thread: Re: Executing a command with options
- Index(es):
Relevant Pages
|