Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
I have one Textbox and one Button.

I want that on click on the button:

- Open CMD and write there "IPconfig /all"
- Copies the information from the CMD and paste it into the Textbox
Posted
Updated 22-Dec-15 4:52am
v2
Comments
Sergey Alexandrovich Kryukov 22-Dec-15 10:53am    
CMD is totally irrelevant here. The question makes no sense at all.
—SA

Try this:

VB
Dim oInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo("ipconfig", "/all")
        oInfo.UseShellExecute = False
        oInfo.ErrorDialog = False
        oInfo.CreateNoWindow = True
        oInfo.RedirectStandardOutput = True
        Dim p As Process = System.Diagnostics.Process.Start(oInfo)
        Dim oReader As System.IO.StreamReader = p.StandardOutput
        RichTextBox1.Text = oReader.ReadToEnd()
        oReader.Close()
End Dim
 
Share this answer
 
Solution 1 should be enough for what you need now, but if you need to interact more fully with a command-line utility, you can do something like what I did:

ProcessCommunicator[^]
 
Share this answer
 
Comments
Leo Chapiro 23-Dec-15 4:05am    
Nice, +5 :)
PIEBALDconsult 23-Dec-15 14:25pm    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900