XP: Run a program as another user with runas

Contributor Icon Contributed by qmchenry  
Tag Icon Tagged: Windows security  

Regardless what operating system you use, it is a dangerous practice to login and perform normal (non-administrative) tasks with administrative privileges. Unwittingly executing a program concealing a trojan horse as an administrator will provide administrative rights to that program and the impact may be much greater.

However, increased security generally causes increased inconvenience. The runas command provides a convenient means of running a program with different credentials, typically as administrator, while working as a less privileged user.


The runas command has many options for its operation. The simplest example is running the command regedit as the user administrator on the local system (which should always be referrable by the name localhost):

runas /user:localhost\administrator regedit

You will be prompted for the password for administrator. If you provide the correct password, the regedit command will start.

To further accomodate laziness, the runas command can be used in a batch file. If you frequently run the regedit command on your system, create a regedit.bat file containing the following text:

@ runas /user:localhost\administrator regedit

Then you can double click on the icon for the batch file you just created to start the regedit (after entering the appropriate password, of course). The @ symbol prevents the commands that follow from being printed to the screen when they are run so the only text in the window that pops up is the password prompt. Dragging the batch file into the start menu or a program group will make it even easier to use.

 

4 Comments -


  1. tahira said on May 27, 2010

    plz open the facebook

  2. Anonymous said on September 21, 2010

    Christian the finestgucci handbagsstore more from
    discount louis vuitton handbags Dior Perfumeslv designer designer
    store replica handbags discount louis vuitton handbagsbag outlet
    Fendi Chandonlouis vuittonWe are Christian

  3. None said on January 23, 2011

    cool recipe and here is another to defrag your system

    runas /user:localhostadministrator “defrag d: -v”

  4. chirag said on July 21, 2011

    i can not create any password for my user accounts.

    so what can i type in user account password??

    mail me:: chiragvpatel20@gmail.com

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -