Replace Notepad in Windows 7

Posted on December 11, 2009 at 5:29 am

If you’re a power user, you probably don’t like the default program used to edit text documents, namely Notepad. It’s been the de-facto text editor in Windows since the beginning of time and hasn’t changed a bit.

If you want to replace Notepad in Windows 7 with another text editor like Notepad2, for example, it can be a bit tricky! Luckily for you, I’ve tried out several methods and found one that works!

In this article, I will walk you through the steps to replace the default Windows Notepad with Notepad2. That way, whenever you double-click on a text file or right-click on a file and choose Edit, it will open in Notepad2 automatically! Sweet.

Replace Notepad with Notepad2

Step 1: First, download the latest version of Notepad2 from the link below:

http://www.flos-freeware.ch/notepad2.html

If you have a 64-bit version of Windows, make sure you download the x64 version under Other Modified Versions of Notepad2.

Step 2: Go ahead and extract the files to a folder on your computer. There should be 4 files.

relace notepad with notepad2

Step 3: Turn off User Account Control in Windows 7. You can read my previous post on how to configure UAC in Windows 7. You need to drag the slider all the way down to Never Notify.

turn off uac windows 7

Note that after the whole procedure, you can restore your previous UAC setting. We are only changing it temporarily so that we can replace some system files. Make sure you restart your computer before going to the next step!

Step 4: Now create a new text file using Notepad or whichever text editor you like and paste the following text into it:

rem START BATCH COMMANDS
rem PLEASE MAKE SURE THAT USER ACCOUNT CONTROL (UAC) IS TURNED OFF AND PC HAS BEEN REBOOTED FIRST!
rem If you are using VISTA x32 version, then edit this file first by adding “rem ” in front of every line that contains the phrase “syswow64?. Then run the script again.
@echo off
PAUSE

takeown /f c:\windows\syswow64\notepad.exe
cacls c:\windows\syswow64\notepad.exe /G Administrators:F

takeown /f c:\windows\system32\notepad.exe
cacls c:\windows\system32\notepad.exe /G Administrators:F

takeown /f c:\windows\notepad.exe
cacls c:\windows\notepad.exe /G Administrators:F

copy c:\windows\syswow64\notepad.exe c:\windows\syswow64\notepad.exe.backup
copy c:\windows\system32\notepad.exe c:\windows\system32\notepad.exe.backup
copy c:\windows\notepad.exe c:\windows\notepad.exe.backup

copy notepad2.exe c:\windows\syswow64\notepad.exe
copy notepad2.exe c:\windows\system32\notepad.exe
copy notepad2.exe c:\windows\notepad.exe
@echo on
rem END BATCH COMMANDS

Save the file as “replace.bat” or whatever you like, just make sure it has a .BAT extension and not a .TXT extension. Make sure you save the file in the same folder as the one that has the four Notepad2 files we just unzipped.

You can read my earlier post on how to create a batch file, which walks you through the steps of saving it properly.

Before you close the file, however, you need to determine whether you are running Windows 7 64-bit or 32-bit. If you are running 64-bit, you’re set.

If you are running 32-bit Windows, you have to go through the script above and put the word “rem” in front of any line that has “syswow64” anywhere in the line. After doing that, you can save the file.

Step 5: Now run the script by right-clicking on it and choose Run as Administrator. This will help to make sure you don’t get an Access is Denied error during the script.

windows 7 replace notepad

The script will give you a couple of warning message, just press any key to keep going. Then it will tell you whether or not it was successful in getting access to the notepad system files.

If it says Success and then asks your “Are you sure?”, type in Y and press Enter. You will have to do this three times.

replace notepad windows 7

That’s it! If you got the success message three times and typed in Y, Notepad is now replace with Notepad2!

If you for some reason got a failure message that says “Access is Denied”, you might have to manually change the permissions on the Notepad app. The reason why this happens is because the files are protected by the Trusted Installer in Windows 7.

You can read my previous article on how to edit files that are protected by Trusted Installer. Basically, take owernship and then give the Administrators group Full Control.

You have to do this for all instances of the Notepad application. I have listed all the possible locations below for 32 and 64-bit Windows 7.

c:\windows\syswow64\notepad.exe
c:\windows\system32\notepad.exe
c:\windows\notepad.exe

Once you have taken ownership and given Full Control, make sure you restart the computer and then try to run the script again. At this point, it should replace all the files with the Notepad2 files.

Finally, if you want all the settings to be saved for Notepad2, you need to copy the Notepad2.ini file to the C:\Windows folder and give yourself Full Control of that file.

If you have any questions or it didn’t work for you, post a comment here and I’ll try to help! Enjoy!

» Filed Under Computer Tips

Related Posts

Comments

22 Responses to “Replace Notepad in Windows 7”

  1. David D said on :

    Sweet tip man. I never knew this was possible. Here’s my question though: you wrote about how to replace Notepad with Notepad2, but what if I want to replace it with Notepad++?

    Would I just change the script to use the Notepad++ EXE file? Thanks for the great info!


  2. ryan said on :

    Why not just right click on a txt file, choose “open with” and “set default program”? seems a lot easier to do it that way…my 2c


  3. akishore said on :

    Ryan, in Windows, any file that doesn’t have a program already associated with it will open with Notepad, i.e. .ini, .bat, .log, etc. Instead of having to change all of those associations, you simply change the default program.


  4. Mark said on :

    But when Patch Tuesday has a fix for notepad.exe, you have to do it all over again.


  5. avidJoe said on :

    After skim reading the article, and looking through the comments I don’t understand why you couldn’t just do the following: rename notepad2.exe to notepad.exe and replace the file wherever it is (for example, %SystemRoot%\system32\notepad.exe)? Could someone clarify this please?


  6. Twolane said on :

    Well, I tried, but I get the following 3 errors when I try to click on a txt file to open it:
    Load langs-xml failed!
    Cannot load the dynamic library
    Scintilla.ext is failed!

    And I can’t go back to MS notepad.exe. I get the same errors.


  7. Kristof Hardy said on :

    There is an installer version, maintained by Kai Liu, you can find a link to it from the notepad2 homepage. It makes the process a bit easier.


  8. Alex said on :

    I agree with Ryan… in my Notepad++ I just opened Settings > Preferences > File Associations and selected all files to be open with Notepad++. This includes .log, .txt, .ini, .vbs, .h and many others that I don´t use frequently.

    I may be missing something but I don´t see the advantage to replace notepad instead of the file associations.


  9. Cr@zy said on :

    Try this for Notepad++. Sorry it’s in French.

    crazyws.fr/blog/?p=1142
    ;)


  10. TUPACALYPSE187 said on :

    If you don’t see the advantage in using this .bat file, then this post isn’t for you. For me and many other people, this makes life much easier to replace the default MS notepad and use one of our choosing. Personally I prefer notepad++ and this tips works the same way, just replace notepad2.exe with notepad++.exe and run in installed folder. Thanks for the .bat file.


  11. Twolane said on :

    Well, after all is said and done, I ended up doing what Alex said, and went into Settings/Preferences and changed Notepad2 file associations.

    At a later date I’ll do a repair to get the original Notepad back in the proper directories.


  12. Sriram said on :

    Works perfectly in XP.. Great work..


  13. Alex said on :

    @TUPACALYPSE187
    I also see a lot of advantages in replacing default MS Notepad. I just think it is much easier to change the file associations… I use notepad++ and you can change several associations at once in the preferences.


  14. Twolane said on :

    Merci bien, Cr@zy! Yours worked!


  15. Pedro said on :

    Works great in windows 7 ultimate x64. I had tried other methods without success.
    Thank you!


  16. Cr@zy said on :

    Your welcome ;)


  17. freedomway said on :

    Could not successfully complete the process (Vista32). As instructed, I placed ‘rem’ before each line referring to 64 and changed notepad2.exe to notepad++.exe. After to start the process, I was able to successfully take ownership of the two files, but when I answered ‘y’ and hit for the final (3rd time), Notepad quickly compiled and closed – I could not capture what happened.

    I manually took ownership of the two files, rebooted and tried again. Same thing. No luck. I finally had to use the file association function in Notepad++. Seems to be working fine. I suppose I like the idea of being able to disconnect the file associations as needed (which Notepad++ allows me to do). I did a search for Notepad.exe and found the folowing: .mui files; files beginning with x86_microsoft…(and referring to c:\windows\winsxs files) – each containing an instance of notepad.exe.

    Additionally, I now have two ‘prefetch’ files – one each for Notepad and Notepad++. No .ini files for either. Both programs seem to be working fine. I am concerned about saving my settings. Then I tried adding the Notepad++.exe location to the .bat file and ran it. It appeared to compile a little longer, but nothing changed functionally – at least as far as I can tell. This is way over my head. I appreciate your knowledge and have added you to my favorite tech sites. If anyone has time for comments to teach this beginner, I would appreciate it. Thank you…


  18. Mike said on :

    Great article! I’ve been using Notepad for so long, I’ve become used to it kind of like a rock in your shoe. Imagine what it must be like with the rock gone!


  19. Larry said on :

    I followed the procedure exactly to install Notepad2 in place of Windows notepad in Windows7 Pro. Now when I attempt to open a text file I get the following message:

    “You May not have the appropriate permissions to access this item”

    I have gone through the previous article “edit files that are protected…” for the new notepad.exe but I still get the same message.

    Please help…


  20. Brooks said on :

    Thanks I have replaced StNotepad in my multiouch Tablet PC. I was looking for a notepad with Multitouch feature, to edit text in tablet mode. I found that StNotepad 2 got this feature with very common and useful gestures. Now I can edit text only with fingers no need of keyboard, mouse and stylus also. And more over it got its own special semitranparency, it’s awsome in Windows7.


  21. DrLaban said on :

    Hmm, I’va succeeded in doing all these steps, but as soon as I return UAC to the default setting I get an error; “Windows cannot find the file specified…” every time I try to start Notepad2 or when clicking a txt-file. What’s up with that?

    Also, since I’ve been trying and retrying, the backup of notepad.exe has been replaced by Notepad2.exe (running them consecutively a couple of times in a row is not a good idea), is anyone willing to share a Notepad.exe in 64-bit version, I’d appreciate it. At the moment I can’t edit txt-files in any real usable way, so I’d like to be able to at least revert to the old way.


  22. DrLaban said on :

    By chance I tried one more thing. Since the dialog also mentioned “You might not have the right permission…” I made one last effort and see if I could figure this one out. When I checked the permissions of Notepad.exe in C:\Windows it only contained Administrators. I added myself to that list with the permissions of Full Control and whaddya know, it works!


Please post your comments/suggestions!