[HELP] Get Command String

Posts 111 of 11 · Page 1 of 1
[HELP] Get Command String
Its possible get a command string for example:

Shell("ping /?")

To put the results in a textbox for example ?
I did that with my IP tracker, use .net reflector and go to tracert help should be in there!
I cant see the code as it is bcuz you used Krypton GUI , And it put alot of numbers and shiit on the code xD
Can you give me that part of code? @VernK
[html]Imports System.IO

Public Class tracert
Dim myStream As Stream

Using sw As StreamWriter = New StreamWriter(myStream)
sw.Write("The date is: ")
sw.WriteLine(DateTime.Now)
' Add some text to the file.
sw.WriteLine(" ")
sw.Write("IP/URL : ")
sw.WriteLine(Form1.TextBox1.Text)
sw.WriteLine(" ")
sw.WriteLine(RichTextBox1.Text)
' Arbitrary objects can also be written to the file.
sw.Close()
End Using

If (myStream IsNot Nothing) Then
' Code to write the stream goes here.
myStream.Close()
End If[/html]
Thats the tracert from command prompt I'm not sure if thats what you wanted
Quote Originally Posted by VernK View Post
[html]Imports System.IO

Public Class tracert
Dim myStream As Stream

Using sw As StreamWriter = New StreamWriter(myStream)
sw.Write("The date is: ")
sw.WriteLine(DateTime.Now)
' Add some text to the file.
sw.WriteLine(" ")
sw.Write("IP/URL : ")
sw.WriteLine(Form1.TextBox1.Text)
sw.WriteLine(" ")
sw.WriteLine(RichTextBox1.Text)
' Arbitrary objects can also be written to the file.
sw.Close()
End Using

If (myStream IsNot Nothing) Then
' Code to write the stream goes here.
myStream.Close()
End If[/html]
Thats the tracert from command prompt I'm not sure if thats what you wanted
That is to write the txt file or something , is not that
I highly doubt it. The command prompt is separate from your application so there's no link between the two, even if you shell from inside your app. You could just ping with VB if you want
[highlight=vbnet]Dim n As New Process
Dim x As New ProcessStartInfo("shutdown", "")
n.StartInfo = x
x.RedirectStandardError = True
x.RedirectStandardInput = True
x.RedirectStandardOutput = True
x.UseShellExecute = False
n.Start()
Dim lalala As New stringbuilder

Dim streeeamm As IO.StreamReader = n.StandardOutput

While Not streeeamm.EndOfStream
Try
If Not streeeamm.ReadLine.Trim = vbNullString Then

lalala.AppendLine(streeeamm.ReadLine.Trim)

End If
Catch ex As Exception
Continue While
End Try
End While
n.WaitForExit()
fuckingTextBox.text = lalala.ToString
[/highlight]

You need to fucking redirect the standrad output and you are gewwwwddd ;D

Plus, since it needs a file to process, you need to create a batch file on the fly and input it to the processinfo.

Feel free to ask if you definitely don't understand it lol.
Thanks, But i dont understand some things like this:

Dim lalala As New stringbuilder ' Stringbuilder not declared, i need to change it or something?

Dim x As New ProcessStartInfo("shutdown", "") ' What i need to put in the second param...?

Thanks, @Hassan
Quote Originally Posted by Lyoto Machida View Post
Thanks, But i dont understand some things like this:

Dim lalala As New stringbuilder ' Stringbuilder not declared, i need to change it or something?

Dim x As New ProcessStartInfo("shutdown", "") ' What i need to put in the second param...?

Thanks, @Hassan
Add this on top of your code:

Imports System.Text

And in your second parameter, you put the parameters or arguments to that process (if it accepts).
Quote Originally Posted by Hassan View Post


Add this on top of your code:

Imports System.Text

And in your second parameter, you put the parameters or arguments to that process (if it accepts).
Ok Thanks ,Solved.

Your code IS FUKING NICE!
Thanks alot, Now im gonna try to fully understand it =) @Hassan
Posts 111 of 11 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?