user2985459
user2985459

Reputation: 11

Using microsoft telnet to copy file from remote location to local host

I am trying to use telnet to copy file from a remote location which happens to be Windows Phone 8 device.

I am using the below 2 commands.

telnet 127.0.0.1 1023 -f C:\Documents\fpsnum.txt 
type "C:\Data\Users\local\log.txt" 

Manually this runs fine but I require to run this through automation. I tried placing these commands in testcase.xml but it doesn't intend to do what it could manually.

I have also tried using bat file to run these 2 commands but the bat file could only launch a telnet session it couldn't execute the second command.

Any idea/suggestions to work this out?

Upvotes: 1

Views: 3336

Answers (1)

Brian White
Brian White

Reputation: 8726

Telnet is meant to be an interactive terminal so it probably won't work this way.

You could use a program like "socket" or "nc" to open a raw TCP session to the server port and send the command that way, capturing the output. That would allow your automation but note that the "telnet protocol", if it is actually in use, will include extra handshake bytes at the start. They're easy to strip out, though, and may not even be there depending on the OS and the program listening on that port.

Upvotes: 1

Related Questions