3

I have a windows 7 user who belongs to admin group. I want to execute sc command that requires admin privileges. I DON'T want to open an elevated cmd, want to be able to simply Win+R->Enter command, enter password and that's all. I tried the runas command, but it doesn't seem to work:

>runas /user:me "cmd"

and it asks for a password, and then the command is executed with normal privileges. I know I could use /user:administrator but I don't know the admin pass and I think the admin user (me) should work.

3 Answers 3

7

Runas does not elevate commands due to UAC.

You can't run elevated commands in the run dialog either. You can download the "Elevation Powertoys" which allow you to elevate commands as elevate <i>command</i>

Or just use the start menu and press Ctrl + Shift + Enter.

4
  • But I can use /user:administrator, right? Commented Sep 9, 2011 at 9:54
  • Depends. It is disabled by default. You would have to enable the Administrator account. Commented Sep 9, 2011 at 17:03
  • Today I learned about CTRL + SHIFT + ENTER. Thank you. Commented Oct 18, 2012 at 20:00
  • Ctrl-Shift will also work when clicking Taskbar programs, to cause them to be run as Administrator. Commented Mar 6, 2020 at 13:00
0

You can use Administrator account for running a command on admin mode without UAC notification

runas /user:Administrator "cmd"

to save credential and run the command without retyping password again:

runas /user:Administrator /savecred "cmd"

NOTE:

Please make sure that you have activated Administrator user from Computer Management-> Local Users and Group and have set a safe password for Administrator user

-1

I had the same problem like you, arguing windows does not provide such a simple thing built in. There exists a 3rd party tool for it I use for a few years now: Elevate.exe

This program does not depend on saved credentials and can be controlled whether waiting until target program exists or not. Elevate64.exe is for 64 bit architecture only, Elevate.exe works for both 32 bit and 64 bit. You can inspect the command-line options and download it here: https://www.winability.com/elevate/

Syntax: elevate [-opt1] [-opt2...] [path]file[.exe] [param1 [param2...]]

Recommended options to use: -wait4exit -noui

Example: Elevate.exe -wait4exit -noui "calc.exe"

Hope it will help you.

1
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Aug 30, 2023 at 11:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.