su Command Prompt

20,422

The equivalent in Windows is the "runas" command, it is similar to the "sudo" command in unix/linux but you have to specify the user as well. A typical example would be:

runas /user:mymachine\administrator [command]

If your user is is an Administrator you can use your own username like so:

runas /user:myusername ipconfig

To elevate an entire command prompt just put "cmd" in as the command to run, ie:

runas /user:myusername cmd

There may be other ways of doing this, but this is the way I've done it for years and have seen done in corporate scripted environments.

Share:
20,422

Related videos on Youtube

Katharina Böhm
Author by

Katharina Böhm

Updated on September 18, 2022

Comments

  • Katharina Böhm
    Katharina Böhm over 1 year

    Possible Duplicate:
    Is there any 'sudo' command for Windows?

    Commands su & sudo could be used to turn whole current terminal session as super user with administration privileges.

    What's the corresponding command of Windows CMD ?

    I know that I can start CMD as administrator by

    • Right click & Start as Administrator
    • Typing CMD in start search bar the CTRL + SHIFT + ENTER

    But I want to evaluate this permission from inside CMD.

  • Some Random Kid
    Some Random Kid almost 12 years
    runas is more like su than sudo. Sudo will attempt to run your command as super user. su is akin to switch user. With runas you can execute commands as a lower privilege user if desired.