What is the Windows equivalent of getty?

In Linux, you can connect a serial terminal to your machine and access it via /dev/ttySx. Similarly, you can connect a serial terminal to your Windows machine and acccess it via COMx. You can easily write text to the the terminal just by writing to those files. In Windows, you can change the terminal settings via Device Manager. In Linux, you can change them via stty. Now suppose that I want to present a login prompt or shell on the terminal. In Linux, I can do this using getty. How can I do this in Windows? What is the Windows equivalent of getty?

I can redirect the output of cmd to the terminal using

cmd > COMx

but this doesn't do anything with stdin or stderr. I am also wondering if maybe this would be possible using PuTTY, but I don't know how if it is.


Solution 1:

This is not possible on pure Windows, but you can use WSL1 to do that. You need WSL version 1 since it can directly use Windows devices with no virtualization.

The procedure is described in article by Scott Hanselman
Connect to a device over Serial COM Port on Windows 10 with WSL1 TTY devices with Windows Terminal and minicom.

Assuming the device is connected to COM4:

  • Install apt install minicom
  • Run for the first time with sudo minicom -s to set the defaults, for example the default port as /dev/ttyS4 and the speed to 9600
  • If you get "cannon open /dev/ttyS4: Permission denied", add your user to the dialout group:
    sudo gpasswd --add myaccount dialout
  • You can now run minicom on the configured COM4 with:
    wsl -d DISTRONAME minicom.

For more details, see the above article.