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.