Have Windows "Run" dialog run as Admin?

44

6

Windows has this nifty little shortcut for running commands. Press Windows+r.

Problem is, is there an easy way to have the commands I run in that dialog to prompt for a UAC credentials dialog and get consent from a admin user.

Right now, I'm trying to run this command in the Run dialog runas /user:admin "regedit.exe"

It works when I run this though: runas /user:admin "cmd"

wag2639

Posted 2010-10-25T08:16:36.843

Reputation: 5 568

Answers

29

I have the exact same problem. The Ctrl+Shift+Enter solution only works if you use the not-as-reliable start menu run box - but for the Win+R run box you are out of luck. The closest thing to a solution I have found is to manually set application properties to 'Run as Administrator' under the program compatibility tab.

For system utilities such as cmd.exe, you can put a shortcut in your User folder (C:\Users\%USERNAME%) and set 'Run as Admin' under shortcut advanced settings. See http://helpdeskgeek.com/windows-7/command-prompt-admin-rights-windows-7/ for detailed instructions. (To run the short cut you have to type the whole file name, e.g. cmd.lnk)

Zaz

Posted 2010-10-25T08:16:36.843

Reputation: 514

Yea, I've noticed that that too. Ctrl+Shift+Enter never actually works for me outside of the Start Menu and even then, its not because its in the search box, but because by default it selects the first thing on the list. – wag2639 – 2010-10-28T06:10:45.123

2Unfortunately I too can confirm this annoying limitation. I don’t like typing things into the Start menu because it takes much longer to use than the Run dialog because the run dialog takes raw input, but the Start menu searches for matching programs, which can take a while if you have a long path. Why oh why doesn’t Ctrl+Shift work with the Run dialog? Even getting an elevated Run dialog is a chore, the fastest way being via an elevated Task Manager. :-( – Synetech – 2011-03-03T20:08:54.997

17

On Windows 8/Server 2012, if you want to run cmd as an administrator you can just use Win + X. Then in the popup menu you can run cmd through the Command Prompt (Admin) option.

See the screenshot: screenshot

Johnius

Posted 2010-10-25T08:16:36.843

Reputation: 171

2+1 for Win+X! Nice hacky shortcut for Win8+ (also works in Win10). – rustyx – 2015-12-14T14:12:53.623

I tried Win+X in a Win7 VM, and it did nothing. Win+R brings up the Run dialog, so the Windows key works fine. Is this for some other version of Windows, or is it provided by some additional utility or controlled by some setting? – a CVn – 2013-05-10T20:17:24.493

4Like he said, Windows 8 and Server 2012. The Win+X shortcut is sort of a consolation for people that missed the Start menu. – Steve Howard – 2013-09-06T23:30:14.463

8

cmd works just like the run command. Pin it to the taskbar, then Ctrl+Shift+RightClick

Bonnev

Posted 2010-10-25T08:16:36.843

Reputation: 228

5And if you pin it to first icon, you get the numeric shortcut too: WIN+Ctrl+Shift+1 – Ciantic – 2015-06-26T07:58:44.557

OR you can run cmd as admin the first time and then pin it. Subsequently, it will always open up as admin – rahuldottech – 2015-12-03T09:56:26.913

5

Press Control+Shift before running a program and it'll run elevated.

Mircea Chirea

Posted 2010-10-25T08:16:36.843

Reputation: 1 365

1This seems to work in Windows 10. Win + R, type command, ctrl + shift + enter – dx_over_dt – 2019-01-18T23:54:56.143

3Does not work to me, not with the run dialog. – Tomáš Zato - Reinstate Monica – 2013-12-30T14:30:57.753

5

This is how you run executable files as administrator from a Windows Run dialog:

RunAs.exe /user:Administrator "regedit.exe"

You must use RunAs.exe instead of runas.

The guy

Posted 2010-10-25T08:16:36.843

Reputation: 51

1ALL CAPS is considered offensive! Please don't post with ALL CAPS again. – Simon – 2013-04-10T05:33:02.400

5Windows filenames are case-insensitive, and PATHEXT includes ".exe", so RunAs.exe and runas resolve to precisely the same command. – Steve Howard – 2013-09-06T23:31:41.320

3

Take a look at Elevation PowerToys for Windows Vista. It allows you to run applications as administrator by simply running "elevate [command]"

Kryten

Posted 2010-10-25T08:16:36.843

Reputation: 1 950

3

An alternative is to turn UAC off completely and always run all programs as administrator. It's maybe not recommended but believe me, it's a relief.

In Vista you could turn it off in the control panel, in Windows 7 you must modify the registry (Note: This is NOT the same as the no nags setting which only hides UAC without disabling it):

Windows Registry Editor Version 5.00 
;Disable UAC
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000

A reboot is required after changing this.

Also be warned that this also disables VirtualStore (the redirection of reads and writes to/from the program files folder). To keep rogue programs intact you need to properly merge the .../AppData/Local/VirtualStore with your program files folders.

CrouZ

Posted 2010-10-25T08:16:36.843

Reputation: 231

4UAC should not be disabled. Its a very useful, though poorly implemented UX-wise, security feature of the OS. – wag2639 – 2012-11-19T05:20:37.973

4Why all the downvotes? This is actually a working solution. When I work, I need admin right very often and I know what I am doing. I don't want UAC to get in my way all the time and I don't want to work around the Run dialog limitations every time. This is not a viable solution for a home computer, but definitely has its appliances. – Jakub Januszkiewicz – 2013-03-19T13:25:52.140

1

just press Win and then enter regedit. windows7 will provide you with some suggestions, rightclick onto regedit.exe and pick "run as administrator".

akira

Posted 2010-10-25T08:16:36.843

Reputation: 52 754

For searching .msc files, you'll have to type the extension as well, for some reason. – svavil – 2017-10-02T08:36:28.403

1

Go to C:/Windows/System32 and duplicate cmd.exe and rename it to let's saj cmda.exe and add atributes to "Run as administrator". So when Win+R, you type cmda (cmd + admin :D) you'll get uac prompt.

a-skuba

Posted 2010-10-25T08:16:36.843

Reputation: 11

0

Since Windows 7 Powershell is automatically included in all machines, leading to an easier and more modern solution to this age old problem.

With powershell, any program can be run as administrator by running Start-Process command followed by the name of the program and Verb runAs to activate the UAC prompt. you can execute powershell commands right from run box so to get something like an adminstrator command prompt, you can write

powershell Start-Process cmd -Verb runAs

This is what It looks like https://www.youtube.com/watch?v=HrhYdXoBors

Judge2020

Posted 2010-10-25T08:16:36.843

Reputation: 157

0

powershell -command "start-process \"cmd.exe\" -ArgumentList \"/C echo select vdisk file="\\oliver-homeserver.lan\backup$\backup.vhd" ◙ attach vdisk | diskpart & pause\" -verb runas"

This will run an elevated command promt which echos commands to the diskpart utility in order to mount a vhd. The strange sign with the circle is an ASCII coded "Enter"-key to pipe multilined commads to diskpart. I hope, that helps, even if you do not need to run diskpart utility.

Oliver R.

Posted 2010-10-25T08:16:36.843

Reputation: 188