Hi All-
Got a script that is calling a batch secure ftp process (Putty's psftp) and
want to capture the output straight to a log file and not to the screen. Any
assistance on how I would do this would be greatly appreciated. The old DOS
redirect also doesn't work because the ftp process runs in a different
shell...
Using WSH 5.6.
I know I can not use shell.run to capture stdout stream and have been
playing with the shell.exec to see if I could make it work to no avail. The
process creates a new text file for writing and executes the psftp process
but I don't know how to get its output over to the text file...

Thanks in advance for any assistance offered.

-Phil

Re: writing stdout to a log file... by Bruce

Bruce
Mon Jun 21 11:03:37 CDT 2004

Phil,

You're probably way beyond this ...

I haven't done it, but as I recall, stdout is only available if you use
cscript, not wscript.

Here's an example I saw ...

Set shell = CreateObject("WScript.Shell")
command = "%comspec% /c dir"
Set scriptExec = shell.Exec(command)
MsgBox scriptExec.StdOut.ReadAll()

hth,
Bruce


"Phil Strack" <philstrack@hotmail.com> wrote in message
news:%23SKFr%23SVEHA.2752@TK2MSFTNGP10.phx.gbl...
> Hi All-
> Got a script that is calling a batch secure ftp process (Putty's psftp)
and
> want to capture the output straight to a log file and not to the screen.
Any
> assistance on how I would do this would be greatly appreciated. The old
DOS
> redirect also doesn't work because the ftp process runs in a different
> shell...
> Using WSH 5.6.
> I know I can not use shell.run to capture stdout stream and have been
> playing with the shell.exec to see if I could make it work to no avail.
The
> process creates a new text file for writing and executes the psftp process
> but I don't know how to get its output over to the text file...
>
> Thanks in advance for any assistance offered.
>
> -Phil
>
>



Re: writing stdout to a log file... by Phil

Phil
Mon Jun 21 13:36:39 CDT 2004

Hi Bruce-
Thanks, I appreciate the reply..
You would be correct, the only way to access stdout stream is by using
cscript.exe with the exec method.

I was using pretty much the same example you provide as a reference to my
script. I think the part it doesn't like is the command line. Since it is
calling a batch of commands in an ftp shell, (i.e. %comspec% /c psftp:
ftpcommand.scr) it is not able to retreive the stream.

My theory may be accurate, but am not sure. I'm hoping someone in the group
with far more expertise than me can confirm..

keep on scripting..
Thanks

-Phil

"Bruce Hensley" <dummy@nowhere> wrote in message
news:uG6YSl6VEHA.2840@TK2MSFTNGP11.phx.gbl...
Phil,

You're probably way beyond this ...

I haven't done it, but as I recall, stdout is only available if you use
cscript, not wscript.

Here's an example I saw ...

Set shell = CreateObject("WScript.Shell")
command = "%comspec% /c dir"
Set scriptExec = shell.Exec(command)
MsgBox scriptExec.StdOut.ReadAll()

hth,
Bruce


"Phil Strack" <philstrack@hotmail.com> wrote in message
news:%23SKFr%23SVEHA.2752@TK2MSFTNGP10.phx.gbl...
> Hi All-
> Got a script that is calling a batch secure ftp process (Putty's psftp)
and
> want to capture the output straight to a log file and not to the screen.
Any
> assistance on how I would do this would be greatly appreciated. The old
DOS
> redirect also doesn't work because the ftp process runs in a different
> shell...
> Using WSH 5.6.
> I know I can not use shell.run to capture stdout stream and have been
> playing with the shell.exec to see if I could make it work to no avail.
The
> process creates a new text file for writing and executes the psftp process
> but I don't know how to get its output over to the text file...
>
> Thanks in advance for any assistance offered.
>
> -Phil
>
>




Re: writing stdout to a log file... by Bruce

Bruce
Tue Jun 22 11:46:31 CDT 2004

Phil,

To qualify ... I am _not_ one who has a lot of expertise.

I don't know if this is really an issue, but the following would seem to
suggest that psftp writes to stderr, not stdout ...

<http://putty.gigafreak.net/wishlist/pscp-stdout.html>

Bruce

"Phil Strack" <philstrack@hotmail.com> wrote in message
news:uZuNw67VEHA.2564@TK2MSFTNGP11.phx.gbl...
> Hi Bruce-
> Thanks, I appreciate the reply..
> You would be correct, the only way to access stdout stream is by using
> cscript.exe with the exec method.
>
> I was using pretty much the same example you provide as a reference to my
> script. I think the part it doesn't like is the command line. Since it is
> calling a batch of commands in an ftp shell, (i.e. %comspec% /c psftp:
> ftpcommand.scr) it is not able to retreive the stream.
>
> My theory may be accurate, but am not sure. I'm hoping someone in the
group
> with far more expertise than me can confirm..
>
> keep on scripting..
> Thanks
>
> -Phil
>
> "Bruce Hensley" <dummy@nowhere> wrote in message
> news:uG6YSl6VEHA.2840@TK2MSFTNGP11.phx.gbl...
> Phil,
>
> You're probably way beyond this ...
>
> I haven't done it, but as I recall, stdout is only available if you use
> cscript, not wscript.
>
> Here's an example I saw ...
>
> Set shell = CreateObject("WScript.Shell")
> command = "%comspec% /c dir"
> Set scriptExec = shell.Exec(command)
> MsgBox scriptExec.StdOut.ReadAll()
>
> hth,
> Bruce
>
>
> "Phil Strack" <philstrack@hotmail.com> wrote in message
> news:%23SKFr%23SVEHA.2752@TK2MSFTNGP10.phx.gbl...
> > Hi All-
> > Got a script that is calling a batch secure ftp process (Putty's psftp)
> and
> > want to capture the output straight to a log file and not to the screen.
> Any
> > assistance on how I would do this would be greatly appreciated. The old
> DOS
> > redirect also doesn't work because the ftp process runs in a different
> > shell...
> > Using WSH 5.6.
> > I know I can not use shell.run to capture stdout stream and have been
> > playing with the shell.exec to see if I could make it work to no avail.
> The
> > process creates a new text file for writing and executes the psftp
process
> > but I don't know how to get its output over to the text file...
> >
> > Thanks in advance for any assistance offered.
> >
> > -Phil
> >
> >
>
>
>



Re: writing stdout to a log file... by Phil

Phil
Tue Jun 22 15:49:14 CDT 2004

Thanks again Bruce...me either.

I'll review the link and see if I can make it work.

Thanks

"Bruce Hensley" <dummy@nowhere> wrote in message
news:OEd06hHWEHA.2176@TK2MSFTNGP11.phx.gbl...
Phil,

To qualify ... I am _not_ one who has a lot of expertise.

I don't know if this is really an issue, but the following would seem to
suggest that psftp writes to stderr, not stdout ...

<http://putty.gigafreak.net/wishlist/pscp-stdout.html>

Bruce

"Phil Strack" <philstrack@hotmail.com> wrote in message
news:uZuNw67VEHA.2564@TK2MSFTNGP11.phx.gbl...
> Hi Bruce-
> Thanks, I appreciate the reply..
> You would be correct, the only way to access stdout stream is by using
> cscript.exe with the exec method.
>
> I was using pretty much the same example you provide as a reference to my
> script. I think the part it doesn't like is the command line. Since it is
> calling a batch of commands in an ftp shell, (i.e. %comspec% /c psftp:
> ftpcommand.scr) it is not able to retreive the stream.
>
> My theory may be accurate, but am not sure. I'm hoping someone in the
group
> with far more expertise than me can confirm..
>
> keep on scripting..
> Thanks
>
> -Phil
>
> "Bruce Hensley" <dummy@nowhere> wrote in message
> news:uG6YSl6VEHA.2840@TK2MSFTNGP11.phx.gbl...
> Phil,
>
> You're probably way beyond this ...
>
> I haven't done it, but as I recall, stdout is only available if you use
> cscript, not wscript.
>
> Here's an example I saw ...
>
> Set shell = CreateObject("WScript.Shell")
> command = "%comspec% /c dir"
> Set scriptExec = shell.Exec(command)
> MsgBox scriptExec.StdOut.ReadAll()
>
> hth,
> Bruce
>
>
> "Phil Strack" <philstrack@hotmail.com> wrote in message
> news:%23SKFr%23SVEHA.2752@TK2MSFTNGP10.phx.gbl...
> > Hi All-
> > Got a script that is calling a batch secure ftp process (Putty's psftp)
> and
> > want to capture the output straight to a log file and not to the screen.
> Any
> > assistance on how I would do this would be greatly appreciated. The old
> DOS
> > redirect also doesn't work because the ftp process runs in a different
> > shell...
> > Using WSH 5.6.
> > I know I can not use shell.run to capture stdout stream and have been
> > playing with the shell.exec to see if I could make it work to no avail.
> The
> > process creates a new text file for writing and executes the psftp
process
> > but I don't know how to get its output over to the text file...
> >
> > Thanks in advance for any assistance offered.
> >
> > -Phil
> >
> >
>
>
>