【发布时间】:2014-10-08 10:41:13
【问题描述】:
我在使用 Visual Basic 时遇到问题。按下按钮时运行 cmd 脚本但是此刻它什么都不做?我想尝试在某些部分的文本框中输入值,但如果有人能指出我哪里出错了,那就太好了!
AAAAA=名字 BBBBB=姓氏
更新代码:
Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button.Click
Dim Command As String
'creating home diretorys'
Command = "mkdir \\bw-file-01\student$\EY{year}\APPTesting"
Command = Replace(Command, "{year}", Year.Text)
MsgBox("Direcotry has been made in" & Year.Text & "file path")
'setting up account'
Command = "dsadd user ""cn={fstname}.{lstname},ou=New_users,ou=students,ou=users," & _
"ou=Broadwater School,dc=broadwater,dc=surrey,dc=sch,dc=uk"" " & _
"-disabled yes -pwd password -mustchpwd yes -desc {desr} -homedirectory {filepath} -homedrive {homedrive} -email {fstname}.{lstname}@broadwater.surrey.sch.uk -upn ""{fstname}{lstname}@broadwater.surrey.sch.uk"" " & _
"-fn ""{fstname}"" -ln ""{lstname}"" -Display ""{fstname} {lstname}"""
Command = Replace(Command, "{fstname}", Firstnamebox.Text)
Command = Replace(Command, "{lstname}", Surnamebox.Text)
Command = Replace(Command, "{desr}", desr.Text)
Command = Replace(Command, "{year}", Year.Text)
Command = Replace(Command, "{homedrive}", "H:")
Command = Replace(Command, "{filepath}", "\\bw-file-01\student$\EY2014\APPTesting")
MsgBox("Account has been made in the" & Year.Text & "group")
Shell("cmd /c" & Command, 1, True)
End Sub
【问题讨论】: