'How to exit telnet session via command line using azure devops

I am trying to test connectivity from source to a FTP server on port 22 using azure devops commandline tool in pipelines

Command for testing: telnet TestSFTP02 22

How do I make sure the telnet connectivity is closed after running this command via the command line?



Solution 1:[1]

You will need to kill the telnet process. For example like this:

(timeout /T 5 > nul && taskkill /f /im telnet.exe > nul) | telnet TestSFTP02 22

Or use more powerful scripting language, like PowerShell.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Prikryl