簡體   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