从CMD读取所有ipconfig [英] Read ipconfig all from CMD

查看:102
本文介绍了从CMD读取所有ipconfig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框和一个按钮。



我想点击按钮:



- 打开CMD并写入IPconfig / all

- 从CMD复制信息并将其粘贴到文本框中

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

推荐答案

试试这个:



Try this:

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


解决方案1应该足以满足您现在的需求,但如果您需要与命令行实用程序进行更全面的交互,您可以执行类似我所做的事情:



ProcessCommunicator [ ^ ]
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[^]


这篇关于从CMD读取所有ipconfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆