繁体   English   中英

tftp' 不是内部或外部命令,也不是可运行的程序或批处理文件

[英]tftp' is not recognized as an internal or external command, operable program or batch file

我一直在尝试使用 C# 中的 tftp 传输文件。 我用 Process 类实现了它。 我在 Windows 中打开了 TFTP 客户端功能。

这是命令——

C:\Users\Desktop>tftp -i 192.168.43.171 put 
"C:\Users\cc\callisto\SampleTool\src\SampleTool\bin\Debug\DecryptedFiles\dserc.bin"
Transfer successful: 32 bytes in 1 second(s), 32 bytes/s

当我手动执行它时传输成功但是当我通过代码尝试它时,它说它无法识别 -

'tftp' is not recognized as an internal or external command,
 operable program or batch file.

这是我的代码

public static void ExecuteCommand(string fileName, string command)
    {
        try
        {
            Process process = new Process();
            process.StartInfo.FileName = fileName;//cmd.exe
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.RedirectStandardInput = true;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.UseShellExecute = false;
            process.Start();
            process.StandardInput.WriteLine(command);//tftp command
            process.StandardInput.Flush();
            process.StandardInput.Close();
            process.WaitForExit();
        }
        catch (Exception ex)
        { }
    }

我面临的确切问题是什么。 谁能帮忙

谢谢。

所以经过这么多的复杂,我找到了这个链接 [https://github.com/Callisto82/tftp.net/blob/master/Tftp.Net.SampleClient/Program.cs]

我能够成功传输文件,没有任何问题。 希望这会有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM