Redirecting run command line output from VBScript 
Author Message
 Redirecting run command line output from VBScript

Hello all,

    I having a problem in one of my scripts when I try to run XCopy as a
shell command and redirect the output of it to a log file.

    If the command is just

XCopy [source] [destination] [options]

then it works fine, but if the command is

XCopy [source] [destination] [options] >> [Log File]

it gives me an error code of 4 and doesn't run.

Is there a reason for this (i.e. is it a security precaution) or???

Thanks in advance,
Kevin



Sat, 15 Mar 2003 03:00:00 GMT  
 Redirecting run command line output from VBScript
Try building the command with "%comspec% /c " beforehand. e.g.
strCommand="%comspec% /c xcopy source dest >> output.txt", wscript.run
StrCommand

Cheers

Stu


Quote:

> Hello all,

>     I having a problem in one of my scripts when I try to run XCopy as a
> shell command and redirect the output of it to a log file.

>     If the command is just

> XCopy [source] [destination] [options]

> then it works fine, but if the command is

> XCopy [source] [destination] [options] >> [Log File]

> it gives me an error code of 4 and doesn't run.

> Is there a reason for this (i.e. is it a security precaution) or???

> Thanks in advance,
> Kevin



Sat, 15 Mar 2003 03:00:00 GMT  
 Redirecting run command line output from VBScript

Worked like a charm,

Thanks,
Kevin


Quote:
> Try building the command with "%comspec% /c " beforehand. e.g.
> strCommand="%comspec% /c xcopy source dest >> output.txt", wscript.run
> StrCommand

> Cheers

> Stu



> > Hello all,

> >     I having a problem in one of my scripts when I try to run XCopy as a
> > shell command and redirect the output of it to a log file.

> >     If the command is just

> > XCopy [source] [destination] [options]

> > then it works fine, but if the command is

> > XCopy [source] [destination] [options] >> [Log File]

> > it gives me an error code of 4 and doesn't run.

> > Is there a reason for this (i.e. is it a security precaution) or???

> > Thanks in advance,
> > Kevin



Sun, 16 Mar 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Redirecting output from Run command

2. redirect output of program run with shell command

3. Sleep command and running a command line in VBScript

4. Passing values into and out of Command Line application *and* command line prompt in vbscript

5. How do I run the command line arguements from VBScript

6. VB4 - problem creating text from redirected output of shell command

7. How to redirect the DOS command output to VB textbox

8. Redirect the output of a command

9. StdIn redirected at command line?

10. Run a DOS command and Get output of a DOS command in VB5

11. Redirect WshShell.Run Output ?

12. Redirecting output from WshShell.RUN

 

 
Powered by phpBB® Forum Software