Windows Tricks: View with Notepad from Explorer
Sure, it's not the greatest of text editors, but it's always there. The venerable Notepad exists on every Windows system. Ever find an unknown file while browsing your computer and want to know what's in it? That "Open With" dialog box sure gets annoying quickly. Or perhaps it's an EXE or DLL you want to look at for printable strings? A .php file on a system with no HTML editor installed?
The Registry Tweak
- Download* view-with-notepad.reg here, and run it.
This is a small tweak that adds a context menu item to every file type the Shell displays. The contents of the file, in case you want to change it or enter the value manually, is: Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\View with Notepad\command]
@="C:\\Windows\\system32\\notepad.exe \"%1\""
Why it Works
HKEY_CLASSES_ROOT is the portion of the registry where, among other things, file type associations are stored. The first entry, *, is associated with every file type. The command,
C:\Windows\system32\notepad.exe "%1"
tells the system to launch Notepad and tell it which file ("%1") to open.
Some notes:
* The quotes around %1 are so that spaces in filenames are treated correctly.
* If you have a localized or customized Windows installation, replace C:\Windows\system32 with the proper path to notepad.
* Pedants might say why not use REG_EXPAND_SZ and %SYSTEMROOT%? Easier to do this manually with regedit.
* Why notepad? Why not Notepad++ or Vim? Notepad is on every Windows machine by default.
Disclaimer
* EDITING YOUR REGISTRY IS POTENTIALLY DANGEROUS. Removing or changing the wrong settings may harm the operation of your computer. If you would like to make a backup of the portion of the registry you are editing, follow Microsoft's instructions, here. I disclaim all responsibility for any ill effects incurred on your computer while performing this edit.