Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to open Notepad and edit the hosts file, I have to invoke the Start menu, find the Notepad shortcut, right click and run as administrator, then open the hosts file in Notepad in order to edit.

Is there a way to use the command line to open Notepad as administrator? Something like press win + R and enter notepad /admin. Is this possible?

share|improve this question

migrated from serverfault.com Jul 9 '11 at 7:36

This question came from our site for system and network administrators.

up vote 5 down vote accepted

You can do it a little bit faster by pressing Win, type in Search notepad and press Ctrl + Shift + Enter.

Or you can keep a command-prompt window open with higher privileges all the time and if some program needs to be opened with elevated privileges just start it from there with for instance: start notepad.

share|improve this answer
    
Appreciated! It's strange that runas /env /user:DOMAIN\ADMINNAME "notepad hosts" asks for the admin password, but when saving it still does not have enough permissions. Your Ctrl+Shift+Enter solution seems to give the right access: it worked for me :) – Armfoot Sep 9 '15 at 11:17

Take a look at runas /? in command prompt.

share|improve this answer
    
This is not much of an answer. Can you elaborate? – Peter Mortensen Jul 21 '15 at 10:33
    
@PeterMortensen When you run that help command (runas /?) they provide this example: runas /env /user:DOMAIN\ADMINNAME "notepad hosts" which opens the hosts file, but it still fails to grant write permissions... – Armfoot Sep 9 '15 at 11:20
  • Press Win + R to open the run command line
  • Type notepad C:\WINDOWS\system32\drivers\etc\hosts

I believe this should open your hosts file in Notepad as an adminstrative user. It does for me anyway.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.