
Redirect output to a file
Yes, of course this will only work with cscript.
wscript.echo using wscript.exe produces a message box, and you
obviously can't redirect a message box to a log file.
Quote:
>This will only work with CSCRIPT. WSCRIPT will not work!
>>Just start the script with cscript and //nologo if you prefer
>>c:\temp>type t.vbs
>>wscript.echo "hello"
>>c:\temp>cscript //nologo t.vbs >foo.log
>>c:\temp>type foo.log
>>hello
>>As you can see, it seems to work for me.
>>>That's not the right answer... I am doing that as a work around until I
>get
>>>the right answer... I want it to work the way I want it... I like things
>to
>>>work the way I want them to... I am going to go over here and wait for the
>>>right answer...
>>>Thanks for your Reply
>>>Russ...
>>>>You must create a file using the FileSystemObject, then send what you
>want
>>>>to echo
>>>>to the file in the script.
>>>>You cannot capture output from a script to a log file
>>>>>OK, I have a script that works and outputs status with WScript.Echo
>(Works
>>>>>in Cscript). Works Great! Then I call it from a .Bat file... Still works
>>>>>Great! Now I want to redirect the output to a log file...
>>>>>test.vbs > test.log => Empty file
>>>>>test.bat > test.log => Empty file
>>>>>test.bat > test.log 2>&1 => Empty file
>>>>>I want to run the script in the Scheduler and have the log file sent to
>>>>>users on completion... Is there another incantation????
>>>>>Thanks Russ...
>>>>>ps: For the most part I really like WSH and have been waiting for
>>>something
>>>>>like it since NT came out.... Thank you Thank you....