Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line Output

Status
Not open for further replies.

FOAD123

Programmer
Joined
Jul 23, 2003
Messages
8
Location
AU
Hi all

Just a quick question to see if anyone knows how i can redirect output from the command line to a designated text?

Thanks

Andrew
 
Try something like this:
Code:
SH = CreateObject("WScript.Shell")
Set X = SH.Exec("YourProg")
Do While X.Status = 0
  WScript.Sleep 100
Loop
While Not X.StdOut.AtEndOfStream Then
  sLine = X.StdOut.ReadLine
  ...
Wend
You can also use the StdErr property

Hope This Help
PH.
 
Okay I guess the first part wasn't really clear.
What I need to do is:

1. Instead of doing a WScript.Echo I want to write to a designated log file. I am guessing I can just (and this is from the help manual):
set fso = CreateObject("Scripting.FileSystemObject")
set tf = fso.OpenTextFile("c:\temp\test1.txt", ForAppending, False)
f.Write "text"

2. I am kicking off a command line process of WinZip (using wzzip.exe) using the Run method. Any error's or text that wzzip.exe might echo I want to capture.. Can I do this with the Exec method and the StdOut?

Thanks,

Andrew
 
Yes, and the StdErr too.

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top