Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running applications through Telnet

I need to create a BAT file to run an application through telnet, but as far as I know there is no way to do this on DOS. Telnet does not allow any command to be sent to the remote machine at the very instant of the connection, and each subsequent command in the BAT file would only be executed after telnet stops. This hypothetical piece of code illustrates what I want to do:

telnet 100.99.98.1 "C:\Application\app.exe -a -b -c"

And that would run the app.exe on the machine 100.99.98.1 with three parameters. Despite my efforts, nothing worked. Is there a way to do that?

Tks,

Pedrin Batista

like image 337
Pedrin Avatar asked Apr 01 '26 13:04

Pedrin


2 Answers

Have you tried:

echo "c:\application\app.exe -a -b -c" | telnet 100.99.98.1

this won't work if the remote telnet server requires a username and password, though.

like image 138
Alnitak Avatar answered Apr 03 '26 03:04

Alnitak


Due to your paths I'm assuming you are working on a windows platform. I'd suggest looking at PsExec from Microsoft/SysInternals which allows you to execute a command on a remote machine.

PsExec is part of the excellent free PsTools package from Mark Russinovich. SysInternals was recently purchased by Microsoft, but the tools remain free.

This does not, however, work over the internet. It uses windows networking port 445 and should only be used on local networks. If you need that I'd suggest using SSH.

like image 34
Todd Avatar answered Apr 03 '26 01:04

Todd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!