新建From1(窗体),新建Text1(TextBox),Command1(按钮CommandButton),代码:
Private CMD As Object
Private Sub Command1_Click()
strCMD = "ipconfig/all"
Set CMD = New DosCMD '启动CMD
Call CMD.DosInput(strCMD)
Text1.Text = CMD.DosOutPutEx(10000)
Set CMD = Nothing
End Sub
添加一个类模块modDosCMD.cls,代码: