C# cmd 提示看不到 telnet.exe [英] C# cmd prompt cannot see telnet.exe

查看:37
本文介绍了C# cmd 提示看不到 telnet.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 C# 和一个控制台程序来创建一个新的 cmd 进程,没有重定向 stdin 或 stdout,所以我可以从这里输入命令行.(我在那里使用 telnet 时遇到问题,所以这一步只是一个调查.)能够在窗口中输入并接收输出.当我切换到 c:Windows\system32 时,输入 dir te*.exe 什么也没显示.在我直接创建的另一个命令提示符中,我看到了文件 (telnet.exe).关于什么是错误的任何建议?

I used C# with a console program to create a new cmd process, did not redirect stdin or stdout, so I could type into the command line from here. (I was having trouble using telnet from there, so this step was just an investigation.) Able to type into the window and receive output. When I switched to c:Windows\system32, typing dir te*.exe shows nothing. In another command prompt I created directly, I see the file (telnet.exe). Any suggestions about what is wrong?

    {

        ProcessStartInfo startInfo = new ProcessStartInfo(@"cmd.exe"); 
        startInfo.UseShellExecute = false;
        startInfo.CreateNoWindow = true;
        startInfo.WindowStyle = ProcessWindowStyle.Normal; 
        startInfo.CreateNoWindow = false;
        startInfo.Arguments = host;
        using (Process p = new Process())
        {
            p.StartInfo = startInfo;
            p.Start();
        }
    }

推荐答案

我相信从 Windows 7 开始,你必须安装 Telnet 作为 Windows 功能.

Since Windows 7, I believe, you have to install Telnet as a Windows Feature.

此处 您有在 Win 7 上启用 Telnet 的指南,但它适用于 Win 8.1 和 Windows 10.

Here you have a guide to enable Telnet on Win 7, but it's applicable to Win 8.1 as well as Windows 10.

以防万一您无法阅读该网站,步骤如下:

Just in case you can't read the site, the steps are:

转到控制面板 -> 程序 -> 打开或关闭 Windows 功能 -> 向下滚动,直到找到 Telnet 客户端选项

Go to Control Panel -> Programs -> Turn Windows Features on or off -> Scroll down until you find the Telnet Client option

这篇关于C# cmd 提示看不到 telnet.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆