Replace Notepad with Notepad2, Vista

By | May 15, 2008

One of my previous posts was about the text editor Notepad2. Which as I mentioned before is a lightweight editor which also has syntax highlighting.

Now I recently noticed a forum post on MSFN, on how to replace Notepad with Notepad2, so without further ado, here is the code:
takeown /f %Systemroot%\notepad.exe
takeown /f %Systemroot%\System32\notepad.exe
icacls %Systemroot%\notepad.exe /grant "%username%":f
icacls %Systemroot%\System32\notepad.exe /grant "%username%":f
IF EXIST %SYSTEMROOT%\SysWOW64 (bcdedit.exe -set loadoptions "DDISABLE_INTEGRITY_CHECKS")
copy %Systemroot%\notepad.exe %Systemroot%\notepad.original.exe
copy %Systemroot%\System32\notepad.exe %Systemroot%\System32\notepad.original.exe
ECHO Original notepad.exe has been renamed to "notepad.original.exe" in its original folder.
copy notepad2\notepad2.exe %Systemroot%\notepad.exe /y
copy notepad2\notepad2.exe %Systemroot%\System32\notepad.exe /y

Now all you need to do is save this into a bat file, I called mine replacenp2.bat. Then just create a folder called notepad2, with a subfolder the same, and place the notepad2.exe file in it, and run the command, and voiola, Notepad is replaced with Notepad2.

So the directory structure should look something like this:

  • notepad2
  • replacenp2.bat
    • notepad2
      • notepad2.exe

Update: Now, I tried running the command, but for some reason (even ran as admin), it didn’t want to copy it. So I opened up an elevated command prompt, and it seemed to copy & replace fine.