Home > Sysinternals, Windows > RCMD, the remote command prompt

RCMD, the remote command prompt

Batch IconOne of the most powerful parts of windows is the command line interface (cmd.exe). I have done things from directory listings to adding users locally, editing registry and even as far as manipulating windows services.

Being able to do all this from command line is great, but when you have multiple machines at different locations, It is nice to do some remote work from time to time. In comes PSEXEC from Microsoft’s Sysinternals. using PSEXEC and a little know-how on writing batch files, I created a batch file that will allow me to use the command line interface on remote PC while the user is still logged on.

The batch is as follows

psexec //%1 -u domainname\user -p password c:\windows\system32\cmd.exe

pause

saving this batch file as c:\windows\rcmd.bat will allow you to start the run command and type rcmd computername and you should get a command prompt for that PC (if you are an administrative user on that PC)

This is great for spot checks or quick changes, but when you want to make changes, but when you need to make changes on more than one PC, you can create a batch file with these changes and use PSEXEC to run the batch on a list of workstations.

First you want to create a text file (I call mine hosts.txt) and input each computer name or IP of the workstation (one host per line)

Next is to open up a command line and type in the following

psexec @hosts.txt -u domain\user -p password -c batchfile.bat

To keep things neat and tidy, I generally creatediscriptive folder with psexec, the batch file, the hosts file and a batch including this command called runme.bat.

Advertisements
  1. Richard J
    June 30, 2013 at 8:38 pm

    Correction:

    Command should be:

    psexec \\%1 -u domainname\user -p password c:\windows\system32\cmd.exe

    It’s \\ not // to specify the computer name.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: