1 Attachment(s)
[RESOLVED] Shell CMD Text output format
Hi there,
Is it possible to get Multi-line text output from the command line into the TextBox and not all in one line?
Used code:
Code:
Dim stCmdInText As String
Dim objShell, objExecObject As Object
stCmdInText = ""
Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c ping -n 3 -w 1000 192.168.0.131")
Do While Not objExecObject.StdOut.AtEndOfStream
stCmdInText = stCmdInText & objExecObject.StdOut.ReadLine()
Text1.Text = stCmdInText
DoEvents
Loop
Output result:
Attachment 185966
Thank you for your support! :)
Re: Shell CMD Text output format
Hello!
have you ever tried to concatenate "vbCrlf"?
Code:
Do While Not objExecObject.StdOut.AtEndOfStream
stCmdInText = stCmdInText & objExecObject.StdOut.ReadLine() & vbCrlf
Text1.Text = stCmdInText
DoEvents
Loop
if this dont work try to concatenate VBNewLine
Code:
Do While Not objExecObject.StdOut.AtEndOfStream
stCmdInText = stCmdInText & objExecObject.StdOut.ReadLine() & vbNewLine
Text1.Text = stCmdInText
DoEvents
Loop
hope it helps!!
Re: Shell CMD Text output format
Quote:
Originally Posted by
Auguro
Hello!
have you ever tried to concatenate "vbCrlf"?
Code:
Do While Not objExecObject.StdOut.AtEndOfStream
stCmdInText = stCmdInText & objExecObject.StdOut.ReadLine() & vbCrlf
Text1.Text = stCmdInText
DoEvents
Loop
if this dont work try to concatenate VBNewLine
Code:
Do While Not objExecObject.StdOut.AtEndOfStream
stCmdInText = stCmdInText & objExecObject.StdOut.ReadLine() & vbNewLine
Text1.Text = stCmdInText
DoEvents
Loop
hope it helps!!
OMG, Thanks a lot! ;) It worked just fine... I'm such a failure, this is what you get after you are in VB6 for 15 years and didn't touched it for the past 1-2 years! :(
Re: [RESOLVED] Shell CMD Text output format
i'm glad it worked! Just try to not be so harsh with yourself!
have a nice day :D