-3
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Shell("CMD.exe")
        SendKeys.Send("net user")("TextBox1.Text")("TextBox2.Text")
        SendKeys.Send("{ENTER}")
    End Sub
End Class

它说:

错误 1 ​​表达式不是数组或方法,并且不能有参数列表。

对于 SendKeys.Send("net user")

4

1 回答 1

0

很高兴您已解决,但请相信我,这不是从 NET 应用程序内部使用 CMD.exe 的正确方法。

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim pi = new ProcessStartInfo()
    pi.FileName = "CMD.EXE"
    pi.Arguments = "/K NET USER " + textBox1.Text + " " + TextBox2.Text
    Process.Start(pi)
End Sub

ProcessStartInfo 类
进程类

于 2013-05-25T12:27:22.653 回答