简体   繁体   中英

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

I have been trying to transfer the files using the tftp in C#. I implemented it with the Process class. I have turn on the TFTP client feature in Windows.

This is the command -

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

And the transfer is successful when I execute it manually But When I try it through the code, it says its not recognized -

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

Here is my code

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)
        { }
    }

What is the exact issue I am facing. Can anyone help

Thanks.

So after so much complication I found this link [https://github.com/Callisto82/tftp.net/blob/master/Tftp.Net.SampleClient/Program.cs]

I was able to transfer the file successfully without any issue. Hopefully this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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