Re: output to a window that allows output text copy from
- From: dNagel <NOTGrandNagel@xxxxxxxxxxx>
- Date: Thu, 30 Aug 2007 15:36:06 -0700
pulled from here...
2.3 Standard I/O
You can read & write the standard I/O streams from VBScript if cscript is your VBScript interpreter. (It doesn't work for wscript.) Here's how:
REM Declare our variables, to be in good form.
Dim fso, stdin, stdout, stderr
REM Need to create a File System Object. It
REM seems that a lot of programs need a File
REM System Object.
Set fso = CreateObject ("Scripting.FileSystemObject")
REM Finally, just get the streams & bind them
REM to those variables we created.
REM Notice that the argument to GetStandardStream
REM corresponds to the Unix/POSIX file REM descriptors.
Set stdin = fso.GetStandardStream (0)
Set stdout = fso.GetStandardStream (1)
Set stderr = fso.GetStandardStream (2)
REM Now we can write to stdout or stderr, or
REM we can read from stdin. Here's an example
REM of output.
stdout.WriteLine "Hello, VBScript."
stderr.WriteLine "I could write an error here."
This doesn't work when wscript is your interpreter. With wscript, FileSystemObject.GetStandardStream returns Null, so you'll get an error when you try to use the stream, not when you create it. If you run a *.vbs program from the command line by typing its name, you'll probably get wscript as your interpreter. If you want to use standard I/O streams, you must run your *.vbs program explicitly with cscript.
is there a way to send the output from a vbscrpt to a window or message box were i can copy/cut the output text from ? or is the only option writing output to a file?
- Prev by Date: Make folder with accompanying shortcut if possible
- Next by Date: Re: File and folder auditing
- Previous by thread: Re: output to a window that allows output text copy from
- Next by thread: Re: output to a window that allows output text copy from