问题描述
我有一个运行cmd.exe的vb.net应用程序,如下所示:
Dim Port1 = CreateObject .Shell)
Port1.Run(cmd.exe)
Port1.Sendkeys(telnet ip address)
Port1.Sendkeys({Enter})
System.Threading.Thread.Sleep(6000)
当cmd运行sendkeys时, p>
'telnet'不被识别为内部或外部命令,
可操作的程序或批处理文件。
我关闭了cmd窗口,打开了另一个cmd,输入命令没有问题。
我需要cmd在vb.net中运行,而不是一个单独的文件。
在Microsoft visual studio Ultimate 2013中运行vb.net。
更新
Telnet没有安装在您的计算机上(据我所知,它在任何现代Windows版本上都没有安装),或者它的安装目录不在PATH环境变量中。
将其安装目录添加到PATH,或者在cmd.exe的参数中指定telnet.exe的完整路径。
I have a vb.net application that runs cmd.exe as the following:
Dim Port1 = CreateObject("WScript.Shell")
Port1.Run("cmd.exe")
Port1.Sendkeys("telnet ip address")
Port1.Sendkeys("{Enter}")
System.Threading.Thread.Sleep(6000)
When the cmd runs the sendkeys a error shows
"'telnet' is not recognized as an internal or external command,operable program or batch file."
I closed the cmd window, opened another cmd, and typed in the command with not problems.
I need cmd to run in the vb.net and not as a separate file.
Running the vb.net in Microsoft visual studio Ultimate 2013.
Update: Can anyone tell me why it is doing the same thing when i move the app to another computer and try to run it?
Either Telnet is not installed on your computer (it's not installed by default on any modern Windows versions as far as I know), or it its installation directory not in the PATH environment variable.
Either add it's install directory to PATH, or specify the full path to telnet.exe in the arguments to cmd.exe.
这篇关于cmd.exe无法识别命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!