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.