4

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

I'm aware of the various options for setting the Run as administrator flag, and for opening an elevated console window. But what if I have a normal console window, and I want to run a command as an administrator? The runas program doesn't seem to have an option that says

Please don't show me some popup that I have to click on.

What I really want is something like sudo for Windows.

Wasif
  • 7,984
  • 2
  • 19
  • 32
Stabledog
  • 471
  • 3
  • 9
  • 17
  • 1
    dupe: http://superuser.com/questions/42537/is-there-any-sudo-command-for-windows – fretje Mar 29 '10 at 13:47
  • This isn't a dupe. The OP is asking for how to spawn a process as an admin. The Win32 term is "elevate". Runas simply spawns a process as a different user. Just like Linux, not all processes have "admin" permissions even though your user credentials have admin permissions. – surfasb Jan 24 '14 at 03:58
  • Aye, I've basically solved the problem by just cutting back on my Windows use :) – Stabledog Jan 25 '14 at 07:00

1 Answers1

1
runas /user:domain\administrator commandtorun

Type runas on its own to see the full syntax.

runas on TechNet

The popup is Windows' User Account Control (UAC) technology, and you can't bypass it because it increases security by requiring user confirmation. This is similar to sudo requiring a password. You can disable UAC, just as you can enable password-less sudo. It's true that UAC isn't quite as configurable as sudo however.

Wasif
  • 7,984
  • 2
  • 19
  • 32
Draemon
  • 778
  • 1
  • 6
  • 14
  • Unfortunately, it doesn't work. There is only one account on the system (mine) which is id'ed as {first.lastname}. It is already an admin account, but those privileges aren't enabled in a standard command line. When I try to do 'runas /user:{machine}\{myname}, it just spits back usage text with no error message. There doesn't seem to be an option for "elevate my privileges". Doing "runas /user:[machine]\Administrator" produces the same response. – Stabledog Mar 29 '10 at 13:51
  • @Stabledog: Is the "Administrator" account enabled? Have you tried simply `runas /user:Administrator` (without machine or domain)? – fretje Mar 29 '10 at 14:15