I have .config files set to open in Notepad++. The files I edit are typically in protected locations (e.g. c:\windows\, c:\program files..., etc..) thus requiring administrator access.

I'd like to be able to double click on a .config file and have Notepad++ open with Administrator privileges. It's fine if the UAC prompt comes up.

Is there a way to do that?

11 Answers 11


The best way to is to go straight to the folder in which Notepad++ is installed (Program Files for 32 bit Windows and Program Files(x86) for 64 bit Windows), there, find the Notepad++ executable, right-click on it, and select Compatibility, and at the bottom check the box for Run as administrator.

This WILL make your application always pop up with a UAC warning, but you'll always have the ability to edit as administrator.

I found this article which allows you to create the shortcut without launching the UAC prompt. It's technically for Windows 10, but should work the same way on Win7+.

  • 2
    We can improve on this by making a copy of the Notepad++ exe file, and setting only the copy to run as administrator. This way, the regular notepad++ won't prompt you every time. Dec 19, 2012 at 17:31
  • 8
    @JoelCoehoorn That can be done via a shortcut instead of a full copy of the exe (go to the Advanced... button on the Shortcut tab of the shortcut's properties window to enable it), that way if you update notepad++ it will update both your non elevated and your elevated shortcuts. Dec 31, 2012 at 20:37
  • and like superuser.com/a/1462628/193963 put both shortcuts to the shell sendto menu
    – Bernhard
    Jul 22, 2019 at 11:29
  • Why doesn't Notepad.exe have this option?
    – xr280xr
    May 14, 2020 at 19:57

I have found that searching for the editor program (e.g. Notepad++) in the Start menu and then typing Ctrl+Shift+Enter lets you run the program as an administrator.

You should then be able to open and edit the file that requires elevated priviledges.

  • 5
    That's not really an answer to the question though, as it asks how to open a file for editing with elevated privileges. Aug 31, 2012 at 10:25
  • You 're right, you open the file from within the editor this way and not by double click.
    – elolos
    Sep 27, 2012 at 13:44

As an improvement over @Askeli's answer, you can first make a copy of the notepad++ executable (Name it something like NotepadUAC). Then set the compatibility mode in the properties of your copy to require administrator mode as suggested by Askeli. Now you should also be able to set your .config files to open up using the copy rather than the original.

The advantage here is that you won't see the UAC prompt when opening files with the original (default) Notepad++ .exe file. The disadvantage is that this copy isn't necessarily going to keep itself up to date in the same way as the original, and might eventually cause problems with mismatched .dll or config versions. But it's always easy enough to uninstall/reinstall if that happens.

  • @akseli's suggestion works, however, I still see the UAC prompt. Anyway, I can live with it. Dec 6, 2010 at 23:38

My solution was to pin Notepad++ to the taskbar. When I need it for system files editing I right click on it, click on "Notepad++", and click on "Run as administrator".

The other solutions modifying the shortcut or making copies of it are fine if you are editing system files all the time. I use Notepad++ on a daily basis but I don't mess with protected files every day.


This wasn't available when the original question was posted in 2010, but as of 2012 - the best answer (at least as I consider it):

Install nppSaveAsAdmin:

From http://sourceforge.net/projects/nppsaveasadmin :

This plugin allows you to save any file as administrator. Just press "Save" in Notepad++ and if you are not allowed to change this file as user, Notepad++ will save it as administrator. Windows XP, Windows Vista, Windows 7, Windows 8 are supported.

The "Save as admin" plugin is available for quick and easy installation from the Notepad++ Plugin Manager. (Plugins / Plugin Manager / Show Plugin Manager / Available. Check "Save as admin", click "Install".)

Notepad++ will continue to run as usual, and without needing to run with full administrative UAC tokens. However, if Notepad++ sees that you're trying to save a file that you are otherwise not allowed access to, it will fork to NppAdminAccess.exe (displaying a UAC prompt). Simply click "Yes", and your file will be saved with administrative privileges.


just a simple and effective method:

  1. create a shortcut on the desktop (c:\program files\notepad++\notpad++.exe -> right click -> sendto -> desktop)
  2. create a copy of that shortcut and add _ADMIN to the shortcut
  3. right click the _ADMIN shortcut - properties - shortcut - button advanced - tick "run as administrator"
  4. open a file explorer and type "shell:sendto"
  5. drag and drop both shortcuts to the opened folder

now you have both notepad++ and notepad++_ADMIN in your "SendTo" list for any file.

Shell contextmenu

  • I've tried with VSCode and for some reason, even though I do get a UAC prompt when it runs from the admin shortcut in Send to... it isn't actually running as admin. Strange. Jan 4, 2023 at 14:25
  1. Make a copy of the .exe of your text editor into the same program files folder and append "Admin" or similar to the name.
  2. Right click the new exe -> Properties -> Compatibility -> Privilege Level -> Check "Run this program as administrator"
  3. Create a shortcut to this exe on your desktop / task bar / start menu
  4. Drag a txt file you want to edit as Administrator (or shortcut to one) into this shortcut

Is the easiest / most flexible way I've found to do this when I have to edit the hosts file for web development. Of course if you just want to open all files of one extension as admin, per Joel's suggestion, you can just use the "open with..." -> "Choose default program" on the copy you created.


Another solution is to open the "Start Menu", search for the Notepad application and right click it. Then click on "Run as Administrator".

You are now able to browse the file system (through "Notepad/File/Open...") for the file you want to edit.

  • thanks i didnt have to install another program
    – austin
    Mar 24 at 0:55

The best way is to set Notepad++ to run as administrator. The problem with that is it breaks the Right Click option. So I made a replacement to the right click option that removes the old one. The nice part of my fix is I added it to the Directory setting in the Registry. So now you can right click on a folder and pick Edit with Notepad++ and it will open all the files in Notepad++ :). I do a lot of VBScript programming. That makes it easy for me to edit all my files making global changes when I come up with a new method of doing something or change an object.

My VBScript backs up the registry keys before it changes them. It does not set Notepad++ as administrator so you have to do that by right clicking on the Notepad++ executable and changing it to run as administrator. I'm starting to research on how to make this a Run as Administrator. When I come up with that I'll edit my post so it gives you the option to edit as Admin or edit normally.

' NAME:   New-OpenWithNotepad++(WinVista7).vbs
' EDITED:  Kevin Dondrea , Gordos-Dondrea Enterprises and Foundation
' DATE  : 8/12/2012
' COMMENT: This script Exports Registry keys and replaced Notepad++ Right Click options.
'   Works with Windows Vista and 7.  Also works for restricted Win XP accounts.

Option Explicit

' =============== START ADD ADMIN RIGHTS ===============
' This adds the Admin Run Function for Windows Vista and 7
' You must put this at the top below computer and End If at the
' very end of the script
If WScript.Arguments.length = 0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "WScript.exe", """" & _
WScript.ScriptFullName & """" &_
" RunAsAdministrator", , "runas", 1
' Do not forget to add End If at the end of the script
' =============== END ADD ADMIN RIGHTS ===============

On Error Resume Next

' =============== START CONSTANT VARIABLES ===============
Const HKEY_CLASSES_ROOT   = &H80000000
Const HKEY_CURRENT_USER   = &H80000001
Const HKEY_LOCAL_MACHINE  = &H80000002
Const HKEY_USERS          = &H80000003
' =============== END CONSTANT VARIABLES ===============

' =============== START DIM VARIABLES ===============
Dim objFSO, objWrite2File, objShell, objReg, objRegistry, objWshShell
Dim strDate, strTime, strTime2, strFileName, strOpenFile
Dim strComputer, strCommand, strHostName, strUserName
Dim intRC, strKeyPath, strValueName, strValue
' =============== END DIM VARIABLES ===============

' --------------------------------------------------------------------------

' =============== START COMPUTER NAME, TIME and DATE ===============
strComputer = "."

' Reads registry for Computer Name
Set objShell = CreateObject("WScript.Shell")
' Edit or Add with Registrry Object
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
strComputer & "\root\default:StdRegProv")

' Same as above but used only to delete registry key
Set objRegistry=GetObject("winmgmts:\\" & _ 
strComputer & "\root\default:StdRegProv")

strHostName = objShell.RegRead ("HKLM\SYSTEM\CurrentControlSet\Services\" & _
strUserName = objShell.RegRead ("HKLM\SOFTWARE\Microsoft\Windows NT\" & _

' Retreives Date and Time
strTime = Right("0" & Hour(now()), 2) & Right("00" & _ 
    Minute(Now()), 2) & Second(Now())
strTime2 = Right("0" & Hour(now()), 2) & ":" & Right("00" & ":" & _ 
    Minute(Now()), 2) & ":" & Second(Now())
strDate = Right("0" & Month(now()), 2) & "-" & Right("00" & _ 
    Day(Now()), 2) & "-" & Year(Now())
' -----------------------------------------------------------

' =============== START BACKUP OF REGISTRY KEYS USED FOR ===============

' Original Command
' strCommand = "regedit /e <FilePath> <RegKey>"

' Local Machine ......
strCommand = "regedit /e " & strHostName & "-" & strDate & "-" & _ 
strTime & "-BackupLM-Notepad++.reg " & _ 

Set objWshShell = WScript.CreateObject("WScript.Shell")
intRC = objWshShell.Run(strCommand, 0, TRUE)
If intRC <> 0 then
 WScript.Echo "Error returned from exporting Registry: " & intRC
 WScript.Echo "No errors returned from exporting the Registry file"
End If
' =============== END BACKUP OF REGISTRY KEYS USED FOR ===============

' -----------------------------------------------------------

' =============== START NEW OPEN * SHELL COMMAND ===============
' Name of Registry Entry Key\Path
strKeyPath = "*\shell\Edit With Notepad++\command"
objReg.CreateKey HKEY_CLASSES_ROOT,strKeyPath

' Name of Registry Entry String
strValueName = ""
strValue = "C:\progra~1\notepad++\notepad++.exe %1"
objReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath,NULL,strValue

' =============== START NEW OPEN DIRECTORY SHELL COMMAND ===============
' Name of Registry Entry Key\Path
strKeyPath = "Directory\shell\Edit With Notepad++\command"
objReg.CreateKey HKEY_CLASSES_ROOT,strKeyPath

' Name of Registry Entry String
strValueName = ""
strValue = "C:\progra~1\notepad++\notepad++.exe %1"
objReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath,NULL,strValue

' -----------------------------------------------------------

strKeyPath = "*\shellex\ContextMenuHandlers\ANotepad++"
objRegistry.DeleteKey HKEY_CLASSES_ROOT,strKeyPath

strKeyPath = "SOFTWARE\Classes\CLSID\{00F3C2EC-A6EE-11DE-A03A-EF8F55D89593}\Settings"
objRegistry.DeleteKey HKEY_LOCAL_MACHINE,strKeyPath

' Ending Message
MsgBox"Notepad++ Right-Click Settings" & VbCrLf & _
"Have Been Created", ,"Click OK To Close Window"

' Cleans up Variables From Memory
Set objFSO = Nothing
Set objWrite2File = Nothing
Set objShell = Nothing
Set objReg = Nothing
Set objRegistry = Nothing
Set objWshShell = Nothing
Set strDate = Nothing
Set strTime = Nothing
Set strTime2 = Nothing
Set strFileName = Nothing
Set strOpenFile = Nothing
Set strComputer = Nothing
Set strCommand = Nothing
Set strHostName = Nothing
Set strUserName = Nothing
Set intRC = Nothing
Set strKeyPath = Nothing
Set strValueName = Nothing
Set strValue = Nothing

End If


Uninstall the plugins (except plugin manager). This fixed the problem for me. You can install one plugin at time to see which plugin(s) causes problems.


The following solution doesn't really allow for the double click scenario but it gives you the power of choice (and technically it's also two clicks):

You can add a 'Run as administrator' menu item to the shell context menu on a per file type (or rather per program) basis. See this article for details on the registry tweak.

  • 1
    @Ramhound Would you please care to check out the linked article and rethink your downvote? Or alternatively point out which answer you are referring to? akseli's answer will always trigger UAC. Joel Coehoorn's answer needed a copy of the .exe file (which won't get automatically updated, as he mentioned). Also it will also always trigger UAC for the specific file type. Marlon's answer just starts the program as admin, you still need to open the file manually in Notepad++. And notepadpp studend user's answer is off-topic AFAICT.
    – ctusch
    Aug 27, 2012 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .