January 28, 2008

Remote Command Line On Windows

For a while now I’ve been curious if there was a way on Windows to get a remote command line from another computer. You know, just a plain old command prompt, that when you entered commands they ran on a remote computer instead of your own. This is a staple on Linux systems, since they are all based on the command line, but with GUI-based Windows it was proving trickier to do.

I had found some halfway solutions that never seemed to work right, and I wasn’t too happy with any of them. But today I think I finally found the answer I was looking for. It does depend on a free little software download, but aside from that there’s no installation or setup required on either computer.

I first read about it on this site. What you do is go to a certain MS TechNet page and download the PSTools package (linked in the right sidebar). This software is from Sysinternals, a development group that was acquired by Microsoft a couple of years ago. So it’s “official” MS software, much like the PowerToys.

Anyway, here are the instructions for use:

  1. Download PsTools.zip from this site.
  2. Extract to a folder on your hard drive. If you can put them in the path, like in C:\Windows\System32, even better.
  3. Open a Command Prompt: Start > Run > cmd.exe
  4. Change to the directory you extracted the files to: cd c:\pstools, for example.
  5. Enter the command psexec \\RemoteComputer cmd.exe. Replace RemoteComputer with the name of the computer you want to take control of. You have to have admin rights on the remote computer.
  6. A Sysinternals EULA might pop up. Accept it.
  7. Watch as a new command prompt appears in your console window. You’re now controlling the remote computer!

I really think this is something that should be folded into Windows itself. And maybe it will be, since Sysinternals is under Microsoft control now. I know that when I’m working from home, or working on my Tahoe office computers from Carson City, sometimes I just want a command line on the remote computer, especially if I’m doing a little housekeeping behind the scenes while a user is on the computer. Now I can do it with no problem, now that I’ve found this neat little tool.

And PsExec is just one of 12 tools in the PsTools package. The rest of them are probably just as useful.

Filed under The Computer Vet Weblog

Comments (20)

Comments RSS - Trackback - Write Comment

  1. Remote-Backups with Webaccess says:

    I am really thrilled to see this article. You have given some instructions for Windows and what about remote command line for linux os called as Mint?Nice post and try posting more articles like these in future.

    Posted February 20, 2008 @ 12:07 am
  2. Wim says:

    “A Sysinternals EULA might pop up. Accept it.”

    If you run psexec with the /accepteula parameter you will not have the popup. Especially valuable when used with other tools from the package.

    And, yes, the rest of them is pretty useful too.

    Posted April 14, 2008 @ 6:59 am
  3. PSExec - Remote access command prompt on Windows | Waco's Malaysia Food, Foto & Fun says:

    […] Reference Official Website […]

    Posted November 1, 2008 @ 7:32 pm
  4. Alex says:

    This is fantastic. I’m really glad I stumbled upon this article, as it’s saved me a lot of hassle and irritated users. 🙂

    Posted April 20, 2009 @ 10:40 am
  5. charles says:

    With Linux this soo common. I found tour article trying to do the same thing. Surprised how hard it is.

    Posted June 8, 2009 @ 1:19 pm
  6. Krzysztof says:

    Unfortunatelly it doesn’t work as one might expect. It’s ok with simple tasks like running commands, that return a stdout or stderr messages. If you run something that runs interactively in a command line and takes over it until you exit, like osql.exe from SQL Server, it’s useless for you – all you see is a blinking cursor that doesn’t react for anything but ctrl+c.

    Posted June 22, 2009 @ 1:05 am
  7. Martin says:

    Good article! There are several apps out there that will get the job done, some free and others not. One such free tool is NetCat (originally developed for the unix environment but later ported to windows as well). The tool is free, but it seems that less and less ppl r using it so it has become harder to find and download. Netcat is the network admin’s swiss army knife. RTM (Remote Task Manager) is a commercial product (free to try for 30 days), and once installed and working will allow you access to the remote windows machine’s task manager.

    As far as simplicity goes and speaking of command line only, NetCat will get the job done!

    Posted June 28, 2009 @ 11:32 am
  8. brian says:

    Works up to the point where I get the message “Access is denied …” to the remote computer. Now what??

    Posted July 18, 2009 @ 7:53 pm
  9. Dan says:


    same here, useless

    Posted July 20, 2009 @ 2:27 am
  10. kevin says:

    useless piece hasn’t really down much coz I can run commands but I need the GUI interface relayed on my screen

    Posted October 16, 2009 @ 3:06 am
  11. Mark says:


    GUI access isn’t the point of this article. Some of us specifically required command line access. If you want GUI access then use VNC. Why Microsoft didn’t build in a proper command line originally I’ll never know. What do Windows server admins do?

    Posted December 19, 2009 @ 2:22 pm
  12. Amitay says:

    excellent article. Thanks!

    Posted December 20, 2009 @ 8:25 am
  13. Prabhakaran’s » Remote Command Line On Windows | The Computer Vet Weblog says:

    […] Link: Remote Command Line On Windows | The Computer Vet Weblog […]

    Posted February 3, 2010 @ 12:39 pm
  14. Gareth says:

    Worked great – I needed to flushdns on a remote system without disturbing the end user. Thanks!

    Posted February 16, 2010 @ 7:52 am
  15. Develop says:

    Hello, we are developing a similar cross platform tool (e.g: control Linux-shell from Windows), and would like to hear from the users of this tool about the desired futures in addition to the existing once. Please answer in a comment here.

    Posted April 16, 2010 @ 8:05 am
  16. Bruce Langston says:

    If I extract the pstools files to c:\windows\system32, should I replace the existing pdh.dll with the form the pstools zip?

    Posted June 30, 2010 @ 8:11 am
  17. Awais says:

    Can some one help me please… I need a script/command to run from my computer to refresh desktop on remote computers. I have full access of remote computers using VNC but i need a command to refresh desktop on more then one computer with out using VNC.


    Posted July 6, 2010 @ 6:51 am
  18. cruisine says:

    i’ve got this message :
    make sure that default admin$ share is enable
    what does it means??
    need ur help soon..

    Posted November 21, 2010 @ 8:00 pm
  19. Vaidee says:

    Can any one tell me how to open a non-executable files through this process. Coz. I can’t open any text files

    Posted February 23, 2011 @ 11:05 pm
  20. Piecrust says:

    Seriously, netcat to remotely access a windows server? It’s unencrypted and unauthenticated. Netcat is a wonderously powerful tool but better be sure you understand what it is and is not good at – remember you can do just about anything with a swiss army, you can even cut bread with it but you’ll always be better off with a proper bread knife.

    Personally a find a decent win32 ssh server does the job with a fully interactive CLI.

    Posted July 2, 2011 @ 4:15 pm

Write Comment