我需要项目帮助。我的目标是打开一个打开CMD的批处理程序,然后自动运行一些命令。我尝试了一些我在网上找到的脚本。会发生什么是CMD打开,显示一些错误,如“End不是内部或外部命令”,然后关闭。如果你们中的一个给了我一个批处理脚本,我可以输入我的命令,然后将其制作成批处理程序,这将非常有帮助。我需要使用批处理文件在CMD中自动运行命令
此外,我不认为这会很重要,但我在64位计算机上运行Windows 8.1。
P.S.这里是我以前使用的脚本:
Private Sub CMDAutomate()
Dim sipdomain As TextBox = txtCommand
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd"
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False
StartInfo.CreateNoWindow = True
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
SW.WriteLine(**Command I want to enter**)
SW.WriteLine(**Command I want to enter**)
SW.WriteLine(**Command I want to enter**)
SW.WriteLine(**Command I want to enter**)
SW.WriteLine(**Command I want to enter**)
SW.WriteLine("exit")
Results = SR.ReadToEnd
SW.Close()
SR.Close()
Invoke(Finished)
End Sub
您看到该错误是因为'end' _isn't_一个批处理命令。您应该编辑您的问题以包含您尝试过的代码。 – SomethingDark
好吧,我添加了它 –
这是vbscript ...或者至少是某些Visual Basic方言。 – SomethingDark