Created
July 4, 2023 03:05
-
-
Save iiviigames/e704849c1e43dab6908bb827b2f534df to your computer and use it in GitHub Desktop.
Add a "Open With Notepad" Context Menu in Windows - Right Click -> Open with Notepad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: The script needs an icon - below are instructions on how to get the notepad icon easily. | |
:: You can also use a custom icon if you want! Whatever goes! | |
:: You need to grab the notepad.exe icon from the executable and save it somewhere. | |
:: Winkey + R will open the Runner (Or right click windows icon, "Run") - Then type the next line and hit enter | |
:: C:\WINOWS\System32 | |
:: Find notepad.exe in here, right click it, and hit properties. (Or, highlight it and Alt+Enter will also do the same.) | |
:: When properties are open, hit the Icon tab along the top, and you should see the image below with a bunch of different sizes. | |
:: Select the 256x256 one, and hit the save button, which is just above the listings, a blue floppy disc image. | |
:: Select a spot like C:\Icons or something and save it. | |
:: Then, pass that in as an argument to the script! | |
:: Now, run the script! You must do it from a console so you can enter an argument, which again is the location of the icon. | |
@echo off | |
REM Set the icon path | |
set "iconPath=%~1" | |
REM Validate if the icon path is provided | |
if "%iconPath%"=="" ( | |
echo Icon path not specified. | |
echo Usage: add_notepad_context_menu.bat [icon_path] | |
exit /b | |
) | |
REM Update the icon registry entry for all file types | |
reg add "HKCR\*\shell\notepad.open" /v Icon /t REG_SZ /d "%iconPath%,0" /f | |
REM Add "Open with Notepad" to the context menu for all file types | |
reg add "HKCR\*\shell\notepad.open" /ve /d "Open with Notepad" /f | |
reg add "HKCR\*\shell\notepad.open\command" /ve /d "\"notepad.exe\" \"%%1\"" /f | |
echo "Open with Notepad" has been added to the context menu for all file types with the specified icon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Remove the "Open with Notepad" entry from the context menu for all file types | |
reg delete "HKCR\*\shell\notepad.open" /f | |
REM Remove the icon registry entry for all file types | |
reg delete "HKCR\*\shell" /v Icon /f | |
REM Remove the "Open with Notepad" command registry entry for all file types | |
reg delete "HKCR\*\shell\notepad.open\command" /f | |
echo "Open with Notepad" has been removed from the context menu for all file types. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Universal Open with Notepad Context Entry
That's right - you can just open any file at all with this. Not just
.txt
files. Have fun, and enjoy the time this will save you.❤️ iivii