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

I want to start Notepad with elevated privileges to edit C:\Windows\System32\drivers\etc\host. Notmally I would type notepad in the search box, and with the program highlighted hot Ctrl + Shift + Enter, click Yes on the UAC prompt and then open the file. I do this often, so I want a batch file to do it.

I tried the following command:

runas /user:Administrator /savecred notepad.exe path\to\file

But this is not exactly what I want, as it prompts for the password of the Administrator account. I really want a command to start a program with elevated privileges for the current user account.

I run Windows 7 RC.

share|improve this question
Note for others seeing this: the correct way to elevate as your own user from a CLI is through PowerShell (or VBScript): Start-Process -Verb runas notepad.exe or from cmd with shorthand powershell -c start -verb runas notepad.exe. PowerShell's -Verb runas does not require switching users as the standalone runas command does. – Bob Jul 21 at 10:45

2 Answers 2

up vote 4 down vote accepted

As Notepad is a Windows tool, you may not set "Run always as administrator", but there's a trick. Create a symbolic link and open the properties dialog. Under the link properties, select Advanced (bottom right button) and select "Run link as administrator". This should elevate the process.

I hope this is still the same on Windows 7 (I tested on Windows Vista).

share|improve this answer
Perhaps you could include the directions to create a symbolic link? I don't think it's something most users would ever find. :) – Joshua Oct 12 '09 at 13:57
I created the symbolic link using mklink. The advanced button is disabled. I turned of UAC instead :p – michielvoo Oct 14 '09 at 22:12
The Advanced button on the Shortcut tab is indeed disabled on my Win7 installation (I'm running 7 Pro x64). However, on the Compatibility tab, there is an option to "Run this program as an administrator" ... so it looks as though things just got moved around between Vista and 7. – David Dec 9 '11 at 16:49

Creating a shortcut to Notepad, and then going to its properties => Advanced run as administrator works on Windows 7 64 bit.

This is a good solution for me. I was looking for a way to add lines to the hosts file. This is not ideal, but it saves me a lot of time finding the damn thing.

share|improve this answer
It is usually at C:\WINDOWS\system32\drivers\etc\hosts – Peter Mortensen Jul 21 at 10:38

Your Answer


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.