How to send command to session - wiwanek/Expect.NET GitHub Wiki

Spawned session is used for automation of interactive behaviors, so one must be able to trigger actions or react on events during session execution - send commands to sessions. The Session class provides void Send(string command) method.

Note that Send() method doesn't append command with 'Enter' key so you have to do it explicitly by adding newline symbol '\n' to the end of the command;

Usage example:

Session session; // object session should be created before calling Send() method...
session.Send("ping google.com\n");