You talk about a tty, a file, and Windows. Is Windows the source, the destination, or both? Is the connection via tcp/ip, or a serial port? Expect is useful for situations where session interaction can vary substantially. There are telnet and ssh modules that don't require the 'arcane' knowledge of expect programming, if there is little or no exception/variable handling. You could also write a perl program that does everything locally, and simply execute it remotely. This could be one via a service, or via ssh/telnet and the command line.