Redirect output to a file 
Author Message
 Redirect output to a 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....



Mon, 12 Feb 2001 03:00:00 GMT  
 Redirect output to a file
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

Quote:

>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....



Mon, 12 Feb 2001 03:00:00 GMT  
 Redirect output to a file
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...


Quote:
>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....



Mon, 12 Feb 2001 03:00:00 GMT  
 Redirect output to a file
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.

Quote:

>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....



Tue, 13 Feb 2001 03:00:00 GMT  
 Redirect output to a file
This will only work with CSCRIPT.  WSCRIPT will not work!

Quote:

>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....



Tue, 13 Feb 2001 03:00:00 GMT  
 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....



Fri, 16 Feb 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Redirect FORM output to local text File

2. How do I redirect stdout output to a file

3. Redirect FORM output to local text File

4. Want to redirect output to an already open file

5. redirecting to DOS output to file

6. Redirect WshShell.Run Output ?

7. how can i redirect the output of gswin32

8. Redirect the output of a command

9. Redirecting run command line output from VBScript

10. Redirect console output?

11. how to execute a program and redirect its output

12. Shell redirect to standard output not working

 

 
Powered by phpBB® Forum Software