Run DOS Commands & Show Output in TextBox using Visual Basic 2010

July 26, 2019 posted by

29 Comments

29 Replies to “Run DOS Commands & Show Output in TextBox using Visual Basic 2010”

  1. Dževad Mehović says:

    To PING address use this code:

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

    Dim textvar As String = TextBox1.Text

    Shell("CMD.EXE /K PING " & textvar)

    End Sub

  2. كبريائي - _& هاكر- يماني says:

    i like the project but i have some problem the problem is when i come to execute the command it tell me that con't fend CMD. please help

  3. Dr Green Thumb says:

    Thanks <3

  4. Mediacours says:

    Thanks very much. I had a problem with the encoding but solved it like this:
    With psi

    .UseShellExecute = False

    .RedirectStandardError = True

    .RedirectStandardOutput = True

    .RedirectStandardInput = True

    .CreateNoWindow = True

    .StandardOutputEncoding = Encoding.GetEncoding(Globalization.CultureInfo.CurrentUICulture.TextInfo.OEMCodePage)

    .StandardErrorEncoding = Encoding.GetEncoding(Globalization.CultureInfo.CurrentUICulture.TextInfo.OEMCodePage)

    End With

  5. R Want says:

    How about using 3 space? like net stop spooler?

  6. MrREIVAX2 says:

    Translated with Google translator
    Hi, it works very well but if I want to connect to Telnet i skip error (telnet 192.168.1.1)

    Cms. Start ()

    As I can do that by pressing 1 button connect to cmd/telnet/192.168.1.1?????

  7. shuai chen says:

    not working. only ping works. dir ,cd not working at all.

  8. Don Liu says:

    tried typing in "dir" but got error message. Why "ping" works but "dir" does not?

  9. Suniq says:

    Im getting a error? Can you help me

  10. His Lombres says:

    Hi LearnToTeach ,

    i'm trying to Tracetcp but i got " WIN32 EXCEPTION WAS UNHANDLE"
    CMD.START

    HOW DO I USE TRACETCP HERE?

    THANK YOU!

  11. Vinicius Silveira says:

    wmic /node:USERNAME computersystem get username – I tried to run this and the system reports me "A first chance exception of type 'System.InvalidOperationException' occurred in System.dll" and the textbox keep empty, do you know whats happening?

  12. sjc snc says:

    Thanks You

  13. iZestyYT says:

    Nice video, How would i constantly output every second so if i do "ping 192.168.0.1 -t -l 5000" it will constantly output into the textbox

  14. Jafir Hussain says:

    Good Job, I have a small question your Code i can only add a single space command like ping google.com can you tell me how to add two space command like ping google.com -t and how also how to add a predefined prefix text like the ping is a predefined command if type google.com i should get the result ……Thanks in advance

  15. Mario | Official says:

    getting error with systemencoding

  16. Carl Towne says:

    First of all: Great code! It was exactly what I was looking for to help with a problem.

    Next: In searching youTube I also found another video that was exactly what I was looking for. So exact, in fact, it WAS this video!

    Seems a few months back a user by the name of "IT Chipnet" posted this video. He doesn't say it's his, but then again he DOESN'T say it's not.

  17. PyroCore says:

    This code is awesome dude. Thanks for the share, it works like a charm. But I'm kinda missing some ordinary commands like "cls, ipconfig/release, ipconfig/renew, nbtstat -R, nbtstat -RR, netsh winsock reset, netsh advfirewall reset" I'm currently working with a little program that can execute some DOS commands if not all if possible, but it's focused on using some small ordinary commands that many times can fix internet issues. I don't really know why it gives me the errors, but well I'm only decent at vb u know 🙂

  18. 26CT1520 says:

    just what I need thank you!

  19. muhammad taufiq hidayat says:

    Private psi As ProcessStartInfo
    Private cmd As Process
    Private Delegate Sub InvokeWithString(ByVal text As String)
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    bro can u tell me about these code means? what is psi?

  20. Billy Kani says:

    i got error on cmd start. please help

  21. Jehaan Naailah says:

    Hi The code works perfectly. Thanks. But I have a question. I want to modify it to run commands from Volatility instead of command prompt. Is it possible?

  22. Daniel Loki says:

    help please gmail: [email protected]

  23. Four Hole says:

    I keep getting:

    An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll
    Additional information: The parameter is incorrect

    Any idea what this could be? Loic may have already figured it out

  24. KnKinell says:

    Thanks! This is excellent! I have a question. Is possible to use a remote cmd? I'm testing with PsExec and trying something like this and I'm already lost.

  25. loic mayoud says:

    doesnt work 🙁 program stop with error at line cmd.Start() with error code : Win32Exception 'System.ComponentModel.Win32Exception' occured in System.dll

  26. Shootingnewb says:

    this works brilliant, however, I want to use PSINFO -s for this but it throws an error "the system cannot find the file specified", however, psinfo works fine when running from command.
    thanks!

  27. ali iraqi says:

    goooooooooood

  28. Levente Csepregi says:

    Hi! Thanks for this great example! I have a question. If i will for example run qwinsta command, than it is does not work. You know maybe why, or what is missing? Thx!

  29. MosquitoGamingGR says:

    cool! thanks!

Leave a Comment

Your email address will not be published. Required fields are marked *