How to run a program on a remote PC via command line?

How can I run a program on a remote Windows PC in our network without the need of killing an existing remote-desktop-connection? I only need a command line for running the program and getting its results.


I think you're looking for PsExec

This is what you'd do to execute a CLI program on a remote computer using PsExec:

psexec \\REMOTECOMPUTER "path_to_program_executable"

You can learn more about PsExec and its various options along with some examples here


On more option is the built in winrs

winrs.exe -r:<RemoteComputerName> <TheCommandToRun>
winrs.exe -r:MyRemoteServer ipconfig

winrs vs. psexec

advantages winrs

  • Built in, no download needed
  • Faster and more reliable than psexec

advantages psexec

  • Works with IP (winrs needs the computername (NetBIOS name) of the machine)
  • Can run processes in system-context