Dirk Bergmann

Developer, panographer. Does consultancy work from own company. Lives in Chiang Mai, Thailand.

Twitter

Chiang Mai

Hua Hin

Thailand Hotels

ListVote - List. Vote. Learn.

Partnerseek - Find Partners

Editing Ruby with Notepad2, replacing Notepad on XP SP2 and Windows Server 2003 SP1/SP2

There are several replacement choices for the aging Notepad, which is still it's simplistic old self even in Vista. One great choice is EditpadLite (free) and the more expensive EditpadPro by fellow Thailand expat Jan Goyvaerts. If you want to edit Ruby with syntax highlighting, go for Notepad2 with Ruby. However, simply removing the old and renaming notepad2.exe to notepad.exe (located in your %systemroot%, usually C:\Windows\) won't cut it, and XP SP2 and the latest security updates for Windows Server 2003 make it even harder.
Follow these steps for a successful replace:

Extract the downloaded Notepad2 files to your %systemroot% (usually C:\Windows or C:\WINNT).

Create a text file in the same directory and rename it to sth. like replacenotepad.bat.

Paste the following script:

@echo Replacing NOTEPAD.EXE with notepad2.EXE ...
REM
REM 1. Prevent the protected file system from doing its thing.
attrib -r -h -s %systemroot%\ServicePackFiles\i386
ren systemroot%\ServicePackFiles\i386\notepad.exe notepad.exe.bak
attrib +r +h +s %systemroot%\ServicePackFiles\i386
attrib -r -h -s %systemroot%\system32\dllcache
ren %systemroot%\system32\dllcache\notepad.exe notepad.exe.bak
attrib +r +h +s %systemroot%\system32\dllcache
REM
REM 2. Make backup copies of Notepad in the Windows, System32 and i386 folders.
copy %systemroot%\ServicePackFiles\i386\notepad.exe %systemroot%\ServicePackFiles\i386\notepad.bak.exe
copy %systemroot%\system32\notepad.exe %systemroot%\system32\notepad.bak.exe
copy %systemroot%\notepad.exe %systemroot%\notepad.bak.exe
REM
REM 3. Copy notepad2 to Notepad in the Windows, System32 and i386 folders.
copy notepad2.exe ServicePackFiles\i386\notepad.exe
copy notepad2.exe %systemroot%\system32\dllcache\notepad.exe
copy notepad2.exe %systemroot%\system32\notepad.exe
copy notepad2.exe %systemroot%\notepad.exe
REM
@echo Succeeded.
@echo
@echo NOTE: When the Windows file protection message pops up,
@echo click Cancel, then click Yes to confirm your intentions. 

REM END OF SCRIPT

Then run the Command Prompt (Run>cmd), change to your %systemroot% (cd %systemroot%) and simply enter replacenotepad.bat (or whatever you called the file).

That should do it. Thanks to Blue Lander for the tip. Happy New Year 2007!