OK, I really really want to replace the default notepad.exe in Windows 7 with Editpad (yes, I want to replace the actual executable, and no I don't want to use something like Notepad2, so please don't suggest that). I used the following batch script which has worked for me before:
@echo off
TITLE EditPad Install Script for Complete Windows Vista and 7 Notepad Replacement
echo.
echo EditPad Install Script for Complete Windows Vista and 7 Notepad Replacement
echo Version 2.0
echo.
echo Confirm to apply? (Press Ctrl-C and answer Y to terminate)
pause
echo.
echo.
if exist %SystemRoot%\notepad.original.exe goto exist_editpad_already
if exist %SystemRoot%\System32\notepad.original.exe goto exist_editpad_already
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.
echo Original notepad.exe has been renamed to "notepad.original.exe" in its original folder.
echo.
echo Overwriting %SystemRoot%\notepad.exe with "%~dp0\EditPad.exe"
copy "%~dp0\EditPad.exe" %SystemRoot%\notepad.exe /y
echo Overwriting %SystemRoot%\System32\notepad.exe with "%~dp0\EditPad.exe"
copy "%~dp0\EditPad.exe" %SystemRoot%\System32\notepad.exe /y
echo.
echo EditPad installation is completed.
echo If no error occurred, EditPad will now replace all Notepad functions.
echo.
pause
goto eof
:exist_editpad_already
echo.
echo INSTALLED EditPad ALREADY! (notepad.original.exe exists in windows or windows system32)
echo.
pause
goto eof
:eof
This script did replace notepad.exe with the Editpad executable, but now if I try and open a text file, I get the error "Your copy of NOTEPAD.EXE appears to have been damaged. Please try reinstalling it from the original setup package."
I am using Windows 7 64 bit. What could I do to force Windows to let me use Editpad as my notepad.exe without giving me this stupid error message?
UPDATE:
I think I have some more information that may help things a bit. The problem seems to be with me running editpad.exe at all inside the system32 directory. If I substitute various other exe files for system32\notepad.exe
they run fine, but when I try to run editpad.exe
inside that directory, Windows 7 gives me a popup dialog: "The publisher could not be verified. Are you sure you want to run this software?" If I click Run, I get the 'file is damaged' error – but ONLY if I'm running it inside the system32 directory. I need to find a way to get this exe running inside the system32 directory.
Best Answer
My idea is to create a supporter app that can piggyback on the Image File Execution registry entries to run EditPad correctly.
Note: You will have to restore your original Windows Notepad first, either through the error message that pops up, or by undoing the changes you made. Otherwise Windows may keep pestering you with the error message no matter what you try.
Tip: Notepad Replacer suggested by Dracs does something similar to what is below automatically. Try that first, unless you have reasons to avoid it such as the application being closed source. In which case, you can use the method below:
Create a batch file with the following code. The batch file could be named Replacer.bat for example, and it could be placed anywhere such as EditPad's installation folder. (I assume EditPad is installed in the path given. If not, please change it.)
""
after START command, otherwise your system can go into an infinite loop of creating new Command Prompt windows.On 64-bit Windows, you may need to add this extra line between the second and third lines:
(optional) Use Batch To Exe Converter to compile the batch file to an executable program. Choose the "Invisible application" option.
EXE
file. However, if you use the batch file itself, you will see a momentary flashing of a command window before EditPad opens.Open Registry Editor by opening Start menu and searching for
regedit
(or using the Run command to runregedit
).Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
If a key (folder in left pane) named
notepad.exe
does not exist insideImage File Execution Options
, click Edit > New > Key and typenotepad.exe
as the new key's name. If it already exists, simply navigate to it.If an entry named
Debugger
(type REG_SZ) does not exist in thenotepad.exe
key (on right side), click Edit > New > String Value and typeDebugger
as the new entry's name.Double-click the entry named
Debugger
and enter the full qualified location and name of the EXE file generated by Batch To Exe Converter or the batch file if you did not use a compiler. Enclose the location in quotation marks."C:\Program Files\EditPad\Replacer.bat"
or"C:\Program Files\EditPad\Replacer.exe"
where Replacer.bat is the batch file and Replacer.exe is the compiled EXE file obtained in step 2, if any.Test the setup by:
If there are any problems, your paths in the batch file created in step 1 may not be correct. All other steps should be OK without any problem if you followed them correctly. Just verify and correct the paths in the batch file (and recompile EXE if needed).