Author Topic: Replace Windows Notepad  (Read 816 times)

Offline Arthur

  • Hero Member
  • *****
  • Posts: 624
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Replace Windows Notepad
« on: April 15, 2009, 07:31:50 pm »
I think I am not telling something new (I have seen it before somewhere), but it makes sense in some cases [e.g. a software developer] to replace the Windows [default] Notepad with of course the adorable HE.
I think it must be available as an option at install time.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Replace Windows Notepad
« Reply #1 on: April 15, 2009, 09:51:09 pm »
Hi Arthur, thank you for forcing me on this task. I want to do this for some months now on my own.

To replace Notepad with an other editor
you have to replace "C:\Windows\Notepad.exe"
with an little app who redirects the launch of notepd to an other (third) app.

A program who do this nicely (with XP)  is ProgLauncher


Notepad.exe will be replaced with ProgLauncher.exe
and there will be an config file where you can add the path to the editor of your choice.

Since there is a windows file protection you have do this with an trick.
The easiest trick is to replace all notepad.exe's in the relevant places at once.

For this you can use my batch





To replace notepad on XP  do this:

0.) make an backup of your C: -Partition
It works for me. Tomorrow i will do some more test on an other test pc.


1.) Download  ProgLauncher  from
http://phi.lho.free.fr/softwares/PhiLhoSoft/freewares/Freewares.en.html



2.) unpack the downloaded archive



3.) modify the file "notepad.cfg"

The first three lines should look like
Code: [Select]
e:\a\HippoEDIT\HippoEdit.exe
"*"
.

As you see,  put in the first line your path to HippoEDIT.exe



4.) in the same folder as the ProgLauncher.exe is
create a new file, called like "_replace_origNotepad_w_HippoEDIT.cmd"



5.) Copy the following code in this new file


_replace_origNotepad_w_HippoEDIT.cmd
Code: [Select]
@ECHO OFF

ren  %windir%\ServicePackFiles\i386\notepad.exe  notepad-original.exe
ren  %windir%\system32\dllcache\notepad.exe      notepad-original.exe
ren  %windir%\system32\notepad.exe               notepad-original.exe
ren  %windir%\notepad.exe                        notepad-original.exe

copy ProgLauncher.exe %windir%\ServicePackFiles\i386\notepad.exe
copy ProgLauncher.exe %windir%\system32\dllcache\notepad.exe
copy ProgLauncher.exe %windir%\system32\notepad.exe
copy ProgLauncher.exe %windir%\notepad.exe
copy NotePad.cfg  %windir%\System32\NotePad.cfg
pause


EDIT:
i put  NotePad.cfg  now  in   %windir%\System32\      instead of %windir%\ , because
CLASSES_\txtfile   and all others   say   "%SystemRoot%\system32\notepad.exe"   too   on XP  (that mean notepad is started from C:\Windows\System32)
(curios what %WinDir% and %SystemRoot%  means? Open DOS-Box  (run cmd)  and type  set and press enter)




6.) run this batch
7.) done


To undo this, use this batch

Code: [Select]
@ECHO OFF
copy %windir%\notepad-original.exe    %windir%\ServicePackFiles\i386\notepad.exe
copy %windir%\notepad-original.exe    %windir%\system32\dllcache\notepad.exe
copy %windir%\notepad-original.exe    %windir%\system32\notepad.exe
copy %windir%\notepad-original.exe    %windir%\notepad.exe
pause



I will build an archive with all files and infos.
Or better i will write an tool who do this all on its own?
To let an user execute this tool from the current HippoEDIT folder, to:
- rename all original notepad.exe
- copy redirect-tool to %WinDir%
- build an config file in %WinDir%, already set with the current working dir  (while launched from HippoEDIT folder)
?


-------------------

I have made this simple AHK script.
It does the same as the batch, but create the NotePad.cfg on the fly and fill in the actual dir as path for HippoEDIT.exe
If you want use on your own risk.  It is tested only on XP.  There are right now no error detections.
This just renames the original notepad.exe   and copy ProgLauncher.exe as new notepad.exe.
You have to run this with admin rights
and from inside the folder where the HippoEDIT.exe is, because this is used as path written to the NotePad.cfg
You need the ProgLauncher.exe in this folder too because it is copied from there.


LaunchHippoEDITinsteadOfNotepad.ahk
Code: [Select]
#SingleInstance force

Run %comspec% /c "ren  %windir%\ServicePackFiles\i386\notepad.exe  notepad-original-HippoEDIT.exe",,Hide
Run %comspec% /c "ren  %windir%\system32\dllcache\notepad.exe      notepad-original-HippoEDIT.exe",,Hide
Run %comspec% /c "ren  %windir%\system32\notepad.exe                   notepad-original-HippoEDIT.exe",,Hide
Run %comspec% /c "ren  %windir%\notepad.exe                                  notepad-original-HippoEDIT.exe",,Hide
Run %comspec% /c "copy ProgLauncher.exe                 %windir%\ServicePackFiles\i386\notepad.exe",,Hide
Run %comspec% /c "copy ProgLauncher.exe                 %windir%\system32\dllcache\notepad.exe ",,Hide
Run %comspec% /c "copy ProgLauncher.exe                 %windir%\system32\notepad.exe",,Hide
Run %comspec% /c "copy ProgLauncher.exe                 %windir%\notepad.exe ",,Hide


FileDelete, %windir%\NotePad.cfg
FileDelete, %windir%\System32\NotePad.cfg
FileAppend , %A_WorkingDir%\HippoEDIT.exe`n"*"`n.`n, %windir%\NotePad.cfg
FileAppend , %A_WorkingDir%\HippoEDIT.exe`n"*"`n.`n, %windir%\System32\NotePad.cfg

Exit



RestoreNotepad.ahk
Code: [Select]
#SingleInstance force

Run %comspec% /c "copy  %windir%\ServicePackFiles\i386\notepad-original.exe  %windir%\ServicePackFiles\i386\notepadnotepad.exe",,Hide
Run %comspec% /c "copy  %windir%\system32\dllcache\notepad-original.exe      %windir%\system32\dllcache\notepad.exe",,Hide
Run %comspec% /c "copy  %windir%\system32\notepad-original.exe               %windir%\system32\notepad.exe",,Hide
Run %comspec% /c "copy  %windir%\notepad-original.exe                       %windir%\notepad.exe",,Hide

FileDelete, %windir%\NotePad.cfg
FileDelete, %windir%\System32\NotePad.cfg
Exit

I want to attach the compiled scripts, but they are 200k each, what is to much in size and not allowed to attach.


.
« Last Edit: April 16, 2009, 09:03:00 am by Stefan »

Online alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Replace Windows Notepad
« Reply #2 on: April 15, 2009, 09:57:52 pm »
Thanks Stefan!

But I think Arthur would search for an easier way :) I would check how it is done in other editors. But I think should be more simple way: fex just changing registry...

Offline Arthur

  • Hero Member
  • *****
  • Posts: 624
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Replace Windows Notepad
« Reply #3 on: April 15, 2009, 10:03:24 pm »
Just found this http://qurlyq.com/29x
We need to change the wording to HE (not Notepad2)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Replace Windows Notepad
« Reply #4 on: April 15, 2009, 10:16:21 pm »
But I think should be more simple way: fex just changing registry...
Registry isn't an good idea, because third party apps may just shellex notepad filespec
The easiest and most working way is to replace notepad.exe with an "redirector" exe
« Last Edit: April 16, 2009, 08:21:06 am by Stefan »

Offline allen

  • Newbie
  • *
  • Posts: 46
  • Karma: +2/-0
    • View Profile
Re: Replace Windows Notepad
« Reply #5 on: April 15, 2009, 10:52:34 pm »
I don't remember which, but one editor I've installed offered to replace notepad.exe for you at install time -- it replaced it with a mini exe that redirected to that editor -- like Stefan's method.

Offline Tomas

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Replace Windows Notepad
« Reply #6 on: April 16, 2009, 01:11:40 pm »
one editor I've installed offered to replace notepad.exe for you at install time -- it replaced it with a mini exe that redirected to that editor
Context editor maybe...

Offline allen

  • Newbie
  • *
  • Posts: 46
  • Karma: +2/-0
    • View Profile
Re: Replace Windows Notepad
« Reply #7 on: April 16, 2009, 01:54:14 pm »
That's the one!
Context editor maybe...

That's the one, thanks Tomas

 

Related Topics

  Subject / Started by Replies Last post
9 Replies
5542 Views
Last post November 10, 2010, 06:47:36 pm
by alex
4 Replies
578 Views
Last post May 24, 2009, 05:54:43 am
by Scott Bilas
10 Replies
3350 Views
Last post April 23, 2010, 12:02:21 pm
by DrakonHaSh
1 Replies
245 Views
Last post December 11, 2010, 01:49:09 am
by alex
6 Replies
273 Views
Last post January 21, 2012, 03:26:37 am
by alex