Windows 10: Open Notepad as Administrator with Context Menu?

Discus and support Open Notepad as Administrator with Context Menu? in Windows 10 Customization to solve the problem; I'm often having to edit batch files in my C: drive or my windows hosts files and forever running into access permissions issues. I've seen a few... Discussion in 'Windows 10 Customization' started by spacedog, May 31, 2017.

  1. spacedog Win User

    Open Notepad as Administrator with Context Menu?


    I'm often having to edit batch files in my C: drive or my windows hosts files and forever running into access permissions issues.

    I've seen a few posts showing how you can make a registry style hack to add a right-click option to open a file as notepad as admin, but none of them seem to work in Windows 10?

    Here's the code that I found to create an .inf file to do this for Win8 (it doesn't work for me in Win10). I'm wondering if any gurus here could help me modify it to work on Windows 10?

    Code: [version]Signature="$Windows NT$"Class="Open in Notepad As Admin for Win8.1"Provider="%Microsoft%" [OpeninNotepadAsAdminInstall]CopyFiles = OpeninNotepadAsAdmin.Files.InfAddReg = OpeninNotepadAsAdmin.AddReg [DefaultInstall] CopyFiles = OpeninNotepadAsAdmin.Files.Inf AddReg = OpeninNotepadAsAdmin.AddReg [DefaultUnInstall] DelFiles = OpeninNotepadAsAdmin.Files.Inf DelReg = OpeninNotepadAsAdmin.DelReg [SourceDisksNames] 55="Open in Notepad as Admin","",1 [SourceDisksFiles] OpeninNotepadAsAdmin.INF=55 [DestinationDirs] OpeninNotepadAsAdmin.Files.Inf = 17 [OpeninNotepadAsAdmin.Files.Inf] OpeninNotepadAsAdmin.INF [OpeninNotepadAsAdmin.AddReg] HKLM,%UDHERE%,DisplayName,,"%OpeninNotepadAsAdminName%" HKLM,%UDHERE%,DisplayIcon,,"C:\Windows\notepad.exe,0" HKLM,%UDHERE%,DisplayVersion,,"%DisplayVersion%" HKLM,%UDHERE%,DisplayPublisher,,"%DisplayPublisher%" HKLM,%UDHERE%,DisplaySize,,"%DisplaySize%" HKLM,%UDHERE%,UninstallString,,"rundll32.exe syssetup.dll, SetupInfObjectInstallAction DefaultUninstall 132 %17%\OpeninNotepadAsAdmin.inf" HKCR,*\Shell\runas,,,"%OpeninNotepadAsAdminAccel%" HKCR,*\Shell\runas,Icon,,"C:\\Windows\\system32\\notepad.exe,0" HKCR,*\Shell\runas\command,,,"%11%\notepad.exe ""%1""" HKCU,%IEHERE%,Secondary Start Pages,0x00010008,"%DisplayURL%";FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND [OpeninNotepadAsAdmin.DelReg] HKLM,%UDHERE%HKCR,*\shell\runas HKCR,Directory\Shell\runas HKCR,Drive\Shell\runas; HKCU,%IEHERE%,Secondary Start Pages,0x00010020,"%DisplayURL%"; did not work to uninstall website, removed all 2nd websites now way to save what you had [Strings] DisplayPublisher = "Microsoft" OpeninNotepadAsAdminName="Open in Notepad as Admin [by MetadataConsulting.ca](Uninstall only)" DisplayVersion = "2014.04.27" DisplaySize = "4 Kb" DisplayURL = "Metadata Consulting" OpeninNotepadAsAdminAccel="Open in Notepad as Admin" UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\OpeninNotepadAsAdmin" IEHERE="Software\Microsoft\Internet Explorer\Main"[/quote]

    :)
     
    spacedog, May 31, 2017
    #1
  2. MarkPahulje MVP, May 31, 2017
    #2
  3. MarkPahulje MVP, May 31, 2017
    #3
  4. dalchina New Member

    Open Notepad as Administrator with Context Menu?

    dalchina, Jun 1, 2017
    #4
  5. Berton Win User
    Don't know if it's what you are looking for but I right-clicked the Desktop, chose New, Shortcut then located notepad.exe in the C:\Windows Folder and finished. Then I right-clicked the shortcut, Properties and in the Shortcut tab clicked Advanced then put a checkmark in Run as Administrator. As has been noted various places since Win10 came out, can't do much with icons on the Start menu or the Tiles but once the Shortcut has been created you can do more with it.
     
    Berton, Jun 1, 2017
    #5
  6. zbook New Member
    See if these command lines/ methods work:

    1) Open administrative command prompt and type or copy and paste:

    runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc
    runas /noprofile /user:mymachine\administrator cmd

    2) Type notepad in the left lower corner search then right click on the best match notepad and run as administrator


    3) This one is similar to Berton's method above except you type the location
    Right click on the desktop and hover over new and select shortcut
    Type the location: %windir%\System32\notepad.exe
    next
    choose the name: Notepad
    Finish
    Right click on the short cut, click properties, click advanced, check run as administrator
    With the shortcut on the desktop it is left click opened automatically as administrator.
     
    zbook, Jun 1, 2017
    #6
  7. Kari Win User
    I have not nor have I had any issues in running any app elevated (including Notepad) from Start Menu or Start tile.


    Open Notepad as Administrator  with Context Menu? [​IMG]
     
    Kari, Jun 1, 2017
    #7
  8. spacedog Win User

    Open Notepad as Administrator with Context Menu?

    These are all good suggestions, but not quite what I was hoping to achieve.

    Given the number of times I need to edit a host file or some of my custom .bat files located in various locations that might have protected permissions that prevent saving updated files, I was trying to find a context-menu driven option. Since I do this with a high-degree of frequency it's annoying having to open notepad and then use the Open menu option and navigate to the files I'm trying to work on.

    The other option is to use Notepad++ with the plugin for saving as an admin to get right-click edit/save options. I just saw this script that worked in Win8 and thought that maybe I could tweak/fix it and get it working in Win10 without having to go for a third-party software solution.
     
    spacedog, Jun 1, 2017
    #8
  9. Berton Win User
    On my computers the .txt files when double-clicked will open in Notepad by default. Can't do that with .bat file as double-clicking them will cause them do what they are programmed to do. Right-clicking a .bat file and choosing Edit lets me do it. I've been doing that way when needed since back in MS-DOS 5 and Windows 3.1 days. I'm sure an appropriate script will work but since I've quit programming I like simpler.
     
    Berton, Jun 1, 2017
    #9
  10. dalchina New Member
    Ok, here's a way to do it using Autohotkey.

    1. write an AHK script like this:
    Run, *runas notepad.exe %1%
    exit
    2. Compile it to e.g. Notepad admin.exe
    3. Using e.g. this program (for convenience) do this:

    Open Notepad as Administrator  with Context Menu? [​IMG]

    to add the compiled program to the context menu.
    (Sorry, I realise that prog is not free... there are others or you can achieve the same using regedit or the venerable Contextedit etc).

    (Here I've added it for all files- you can choose which one or ones you want).

    Now right clicking a file and clicking 'Notepad admin'

    Open Notepad as Administrator  with Context Menu? [​IMG]


    gives a UAC prompt ('cos Notepad's run as admin) and opens your file.
     
    dalchina, Jun 1, 2017
    #10
  11. spacedog Win User
    Genius, Dalchina. Works a treat. Even works properly after I replace notepad with notepad2! Thank you!
     
    spacedog, Jun 2, 2017
    #11
  12. dalchina New Member
    Well done for understanding that!
     
    dalchina, Jun 2, 2017
    #12
  13. hooger Win User

    Open Notepad as Administrator with Context Menu?

    hooger, Apr 5, 2018
    #13
Thema:

Open Notepad as Administrator with Context Menu?

Loading...
  1. Open Notepad as Administrator with Context Menu? - Similar Threads - Open Notepad Administrator

  2. Windows terminal is not opening in the explorer context menu; notepad modern app is not...

    in Windows 10 Gaming
    Windows terminal is not opening in the explorer context menu; notepad modern app is not...: I clicked "Open in Windows Terminal" in the desktop context menu and nothing happens, so as the notepad modern app in run dialog won't launch when I typed "notepad", these problems happened at the same time so I think this is the same problem. I installed millions of apps on...
  3. Windows terminal is not opening in the explorer context menu; notepad modern app is not...

    in Windows 10 Software and Apps
    Windows terminal is not opening in the explorer context menu; notepad modern app is not...: I clicked "Open in Windows Terminal" in the desktop context menu and nothing happens, so as the notepad modern app in run dialog won't launch when I typed "notepad", these problems happened at the same time so I think this is the same problem. I installed millions of apps on...
  4. How to add Open Windows Terminal as administrator in the Context Menu

    in Windows 10 News
    How to add Open Windows Terminal as administrator in the Context Menu: Windows Terminal lets you open Command Prompt, Windows PowerShell, etc., in one window. If you want to add Open Windows Terminal as administrator option in the context menu, here is how you can do that. Although you can find the Open in Windows Terminal option in the context...
  5. W10 Open with context menu problem

    in Windows 10 Software and Apps
    W10 Open with context menu problem: Hi, I recently did a system "fresh start" on my laptop (to keep existing user folders/files and drivers etc), as it had slowed up a bit. This took about 20 minutes, it removed all the 3rd party apps, and the pc is functioning fine, however, I soon found out that there is a...
  6. Windows Context Menu Not Opening

    in Windows 10 Customization
    Windows Context Menu Not Opening: Hey Anyone, WHEN I RIGHT CLICK ON TASKBAR AND SELECT TASKBAR SETTING IT DOES NOT OPEN SETTING ELSE IT FLASHES COMMAND PROMPT LIKE SOMETHING WHICH JUST POPS UP AND CLOSE AND NOTHING HAPPENS... THE SAME PROBLEM ALSO OCCUR WHEN I RIGHT CLICK ON DESKTOP AND SELECT DESKTOP...
  7. context menu is missing the 'OPEN' option

    in Windows 10 Customization
    context menu is missing the 'OPEN' option: context menu is missing the 'OPEN' option https://answers.microsoft.com/en-us/windows/forum/all/context-menu-is-missing-the-open-option/0d7c340c-17ef-4b71-893c-e6da8327f7e2
  8. context menu 'open' video

    in Windows 10 Performance & Maintenance
    context menu 'open' video: When i right click on a video and select open my video opens in windows media player. I would like to edit the open value in the registry so it opens in another program. Can anyone point me in the right direction as to where this 'open' value would be. I have found 'open...
  9. open with notepad context menu

    in Windows 10 Customization
    open with notepad context menu: Code: ;notepad [HKEY_CLASSES_ROOT\*\shell] @="\"notepad.exe %1\"" [HKEY_CLASSES_ROOT\*\shell\open] @="Open &With Notepad" [HKEY_CLASSES_ROOT\*\shell\open\command] @="notepad.exe %1"[/quote] the above dont seem to give me open with notepad in context menu unlike in win7. any...
  10. Open with Notepad context menu - Add or Remove in Windows 10

    in Windows 10 Tutorials
    Open with Notepad context menu - Add or Remove in Windows 10: How to: Open with Notepad context menu - Add or Remove in Windows 10 How to Add or Remove 'Open with Notepad' Context Menu in Windows 10 Adding "Open with Notepad" to the context menu of all files will allow you to quickly open that file with Notepad without setting...

Users found this page by searching for:

  1. create context menu to open as admin