Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced the Default Notepad.exe provided by windows, unable to get back the default one #11

Open
sunilkum84 opened this issue Mar 27, 2022 · 1 comment

Comments

@sunilkum84
Copy link

as this has replaced the default notepad.exe.
[Create new text document" option is also missing from context menu]
can you suggest some steps to get back the default notepad.exe application

@ALeX400
Copy link

ALeX400 commented Sep 11, 2023

the simplest option:
the plugin has a .bat file where you can uninstall the plugin
you can also find it after you download any version from here: https://github.com/lygstate/NotepadStarter/releases
but to keep things simple, this is the code:

::By using short path, to support place in Unicode Path
@echo off

::Gain Administrator permission
set SHOW_SUBWINDOW=0
call "%~dps0request-admin.bat" "%~dpnxs0" %*

call :RetrieveFileTime NotepadStarterTime "%SystemRoot%\NotepadStarter.exe"

call :RecoverNotepad "%SystemRoot%"
call :RecoverNotepad "%SystemRoot%\System32"
call :RecoverNotepad "%SystemRoot%\SysWOW64"

del /F /Q "%SystemRoot%\NotepadStarter.exe"

cd /d %~dps0..
if exist "NotepadStarter\.git" (goto skipGitRepository)
del /F /Q NotepadStarterPlugin.dll
:skipGitRepository

reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f
reg delete "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f /reg:64
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f /reg:32

if "%1"=="uninstall" goto uninstall_direct

rd /s /q NotepadStarter & pause

:uninstall_direct
rd /s /q NotepadStarter

goto :eof
:RecoverNotepad           -Passing the directory have notepad.exe who will be replaced
setlocal
@echo on
cd /d "%~1"
if not exist notepad.NotepadStarter.exe (goto recoverFile)
if not exist notepad.exe (goto recoverFile)

takeown /f notepad.exe
echo y | cacls notepad.exe /Grant Administrators:F

call :RetrieveFileTime CurrentFileTime notepad.exe
if "%NotepadStarterTime%" equ "%CurrentFileTime%" (goto recoverFile)
del /F /Q notepad.NotepadStarter.exe
:recoverFile
echo y | move /-Y notepad.NotepadStarter.exe notepad.exe
endlocal

goto :eof
:RetrieveFileTime    - Retrieve the file modification time %1 from the the file %2
if "%~1" EQU "" goto :eof
if "%~2" EQU "" goto :eof
setlocal
for %%a in ("%~2") do set "FileDate=%%~tza"
echo Calculating "%~2" with result:%FileDate%
endlocal & set "%~1=%FileDate%"

goto :eof

open notepad
copy > paste the above code
select: File > save as...
filename: uninstall.bat
change type to: all files (*) and click save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants