Solved

How do I send text to stdout?

Posted on 2003-12-02
11
8,842 Views
Last Modified: 2012-05-04
How do I send text to stdout?

Thanks.
0
Comment
Question by:turn123
  • 5
  • 5
11 Comments
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
0
 
LVL 11

Author Comment

by:turn123
Comment Utility
Line three character twelve gives and error "Syntax error".  I'm trying to write a VBScript.
0
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
To stdout

Just use

Wscript.Echo

example, read and write from stdout (cmd.exe)

http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_wsh_pkoy.asp

0
 
LVL 11

Author Comment

by:turn123
Comment Utility
It looks like that article captures the stdout of another program.  I want to be able to write to stdout so I can caputure the output with another program.

Something like

out = "text"
stdout.write(out).

I can't figure out how to do it though.

Thanks for your help.
0
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
Is it just

Wscript.Echo
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
ie

out = "text"
Wscript.Echo out
0
 
LVL 11

Author Comment

by:turn123
Comment Utility
That brings up a message box that says text regardless of how the program is called.  If you call it through the command prompt you get a message box rather then text.

I need it to send the text to the standerd out that can be read other programs.
0
 
LVL 9

Expert Comment

by:TooKoolKris
Comment Utility
Here is some code you can actually use that does what you requested. It's for .vbs a script that runs IPConfig.exe, and then echoes only the line of output that includes the IP address of the local computer. This script must be run from the command prompt(cscript) as all scripts that have STD objects must be.

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("%comspec% /c ipconfig.exe")

Do Until objExecObject.StdOut.AtEndOfStream
    strLine = objExecObject.StdOut.ReadLine()
    strIP = Instr(strLine,"Address")
    If strIP <> 0 Then
        Wscript.Echo strLine
    End If
Loop
0
 
LVL 11

Author Comment

by:turn123
Comment Utility
Thank you.

I still don't see how to get it to print my text "test".

Could you show me how please?

Thanks.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 100 total points
Comment Utility
Try this


in tt.vbs

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("%comspec% /c c:\temp\aa.vbs")

Do Until objExecObject.StdOut.AtEndOfStream
    strLine = objExecObject.StdOut.ReadLine()
    Wscript.Echo strLine
Loop


in aa.vbs

Wscript.Echo "test"
Wscript.Echo "test1"


When you run tt.vbs, you should see the line show on the cmd
0
 
LVL 11

Author Comment

by:turn123
Comment Utility
That did it.
Thank you very much.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now