When I need to run a command on a remote windows machine, I use Microsoft Remote Desktop software. I was wondering if there is a way to connect to a remote windows command line (cmd.exe) directly from macOS terminal?
An extremely popular option of connecting to remote computers' command lines is the SSH system (secure shell).
In order to use SSH, you'll need a server and a client.
Windows 10 comes with OpenSSH Server as an optional install from Microsoft. You can also use third party servers such as for example the Moba SSH server. You'll need to install and run the server taking care that firewalls, etc. are not blocking anything.
macOS comes with the client (and server) built-in. You'll want to open Terminal.app and run the following command:
ssh -l<username> <IP>
where should be replaced with your Windows user name, and with the hostname or IP-address of your Windows PC.