我知道我需要运行的2条命令是:
pkgmgr /iu:"TelnetClient"
Telnet Towel.blinkenlights.nl
我希望它在运行Telnet Towel.blinkenlights.nl
之后保持cmd打开。
这是我尝试过的:
Dim start As New Process()
start.StartInfo.FileName = "cmd.exe"
start.StartInfo.Arguments = "/c pkgmgr /iu:" & """" & "TelnetClient" & """"
start.StartInfo.CreateNoWindow = True
start.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
start.StartInfo.UseShellExecute = False
start.Start()
System.WaitForExit()
Dim playSW As New Process()
playSW.StartInfo.FileName = "cmd.exe"
playSW.StartInfo.Arguments = "/k Telnet Towel.blinkenlights.nl"
playSW.Start()
playSW.WaitForExit()
答案 0 :(得分:1)
您可以使用流程的WaitForExit命令来确保流程完成:
Dim start As New Process()
start.StartInfo.FileName = "cmd.exe"
start.StartInfo.Arguments = "/c pkgmgr /iu:" & """" & "TelnetClient" & """"
start.StartInfo.CreateNoWindow = True
start.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
start.StartInfo.UseShellExecute = False
start.Start()
start.WaitForExit()
Dim playSW As New Process()
playSW.StartInfo.FileName = "cmd.exe"
playSW.StartInfo.Arguments = "/c Telnet Towel.blinkenlights.nl"
playSW.Start()
playSW.WaitForExit()
答案 1 :(得分:0)
谢谢您的答复,为了解决我的问题,我安装了32位版本的Putty,并通过将-telnet Towel.blinkenlights.nl传递给它来建立telnet连接。 之所以可行,是因为32位VB程序随后可以打开32位Putty并调用命令。之所以无法正常运行,是因为telnet.exe需要64位程序。