Let's assume that I have an IP address of the PC, which I want to connect to. If I want to connect to other PCs' cmd prompt and type the command in it, what should I do? Is there any ways or tools to do it?
You can use SSH to log into a remote machine and enter commands on the remote machine. Here is a link to a tutorial which covers the basics of SSH: https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys