If I open Win + R window and type notepad, then notepad opens.
How can I open it as admin the same way?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Run Once as Admin
The command syntax you want to use is:
runas /user:<localmachinename>\administrator notepad
NOTE: Designating the machine name is optional. It works like this too:
runas /user:administrator notepad
administrator for the account name that has admin access. You will need to authenticate using this process.
As @EBGreen suggested in the comments, you can save the credential on the first execution and avoid reentering it on subsequent calls. This option only lasts for the existing logon session:
runas /user:administrator /savecred notepad
Always Run As Admin
You can also set it so that all programs run in admin mode. This is typically not recommended as UAC exists for a reason, but if you're so inclined follow the steps here:
As far as I know, this task will be started with Admin rights if it is started using +R when UAC is disabled
Anyway, you can do the same if you press key, type
notepad in the Search field and press Ctrl + Shift + Enter
If you don't mind using a third party program, there are several programs named
elevate.exe written by different people. These programs work (mostly) like this:
and then a UAC dialog pops up. Confirm it and your notepad has admin privilege.
Here's a blog post about this: http://www.raymond.cc/blog/trigger-uac-elevation-from-command-line-with-elevate-utility/
runas method often suggested has a major problem - it requires the use of a different account (
Administrator), with the associated different profile.
Administrator also happens to default to disabled. Running as any other standard administrative account actually uses the UAC-restricted token, defeating the purpose.
It is possible to elevate as your current user purely through the command line without third-party tools, though it's a little more complicated. One way is through the PowerShell
Start-Process commandlet. The full invocation is:
Start-Process -Verb "runas" notepad.exe
Shortening it, we can get:
start -verb runas notepad.exe
Running it from the command line, or from the Run dialog:
powershell -c start -verb runas notepad.exe
It's also possible to save a script that can be run simply as
elevate, like in AgreeOrNot's answer - which, again, doesn't require any third-party tools.
I have another solution for you.
Press windows key, write down notepad and press
This will automatically open notepad (or any other programs windows searched for) as admin.
This doesn't quite answer your exact question but you can open notepad as admin by doing the following:
There is a work around solution for this in Microsoft forum. copy paste below lines to a notepad and save it as sudo.cmd and place it in the system32 folder
@echo Set objShell = CreateObject("Shell.Application") > %temp%\sudo.tmp.vbs
@echo args = Right("%", (Len("%") - Len("%1"))) >> %temp%\sudo.tmp.vbs
@echo objShell.ShellExecute "%1", args, "", "runas" >> %temp%\sudo.tmp.vbs
Now, take a Run terminal and type
Hope this will help you.
The Simplest Way I know to do this is to Right Click on the Normal Desktop Shortcut for the program, Choose Properties, Choose compatibility, Click off the "Run This Program as Administrator" then (if you choose) click "Change Settings for All users" This takes care of it and stays that way.