Remplacer notepad par notepad2 en 1 script

Je viens de trouver le script qui me manquai pour remplacer automatiquement notepad par notepad2.

1 / Télécharger notepad2

2 / Décompresser le fichier

3 / Dans le repertoire où est décompressé notepad2 creer un nouveau fichier notepad2.bat.

4 / Dans ce fichier rentrer ces instructions :

@echo off
echo *IMPORTANT*
echo This will kill all open instances of Notepad.
echo To cancel, end this batch file now (ctrl+c), or hit any key to continue.
pause
echo Killing all instances of notepad running...
TASKKILL /F /IM notepad.exe /T
echo Backing up...
call :backup %systemroot%\servicepackfiles\i386
call :backup %systemroot%
call :backup %systemroot%\System32
call :backup %systemroot%\System32\dllcache
echo Installing...
copy notepad2.exe %systemroot%\servicepackfiles\i386\notepad.exe /y
copy notepad2.exe %systemroot%\notepad.exe /y
copy notepad2.exe %systemroot%\System32\notepad.exe /y
copy notepad2.exe %systemroot%\System32\dllcache\notepad.exe /y
echo Done.
pause
goto :end
:backup
call set npath=%1
set count=0
for %%i in (%npath%\notepad.original*.exe) do (
set nname=%%i
set /a count=count+1
)
echo backing up to %npath%\notepad.original%count%.exe
copy %npath%\notepad.exe %npath%\notepad.original%count%.exe /y
:end

Enregistrer puis quitter le fichier notepad.bat

5 / Double cliquez sur le fichier notepad.bat

6 / Suivez la procédure qui s’affiche (appuyé sur ENTER)

7 / Windows vous informe que notepad a été modifié. Faite annuler puis OK.

Enjoy Source

Une réflexion sur « Remplacer notepad par notepad2 en 1 script »

  1. Pour les personnes sous Windows 7 ce script ne marche pas. Alors voici la solution :
    Même procédure mais le script est le suivant (exécuter le .bat en tant qu’administrateur) :

    @echo off
    TITLE Notepad2 Install Script for Complete Windows Vista and 7 Notepad Replacement
    echo.
    echo Notepad2 Install Script for Complete Windows Vista and 7 Notepad Replacement
    echo Version 1.2
    echo.
    echo (c) My Digital Life (www.mydigitallife.info)
    echo.
    echo.
    echo.
    echo Confirm to apply? (Press Ctrl-C and answer Y to terminate)
    pause
    echo.
    echo.

    if exist %Systemroot%\notepad.original.exe goto exist_notepad2_already
    if exist %Systemroot%\System32\notepad.original.exe goto exist_notepad2_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.
    copy %~dp0\notepad2.exe %Systemroot%\notepad.exe /y
    copy %~dp0\notepad2.exe %systemroot%\System32\notepad.exe /y
    echo.
    echo Notepad2 installation is completed.
    echo If no error occurred, Notepad2 will now replace all Notepad functions.
    echo.
    pause
    exit

    :exist_notepad2_already
    echo.
    echo INSTALLED NOTEPAD2 ALREADY!.
    echo.
    pause
    exit

Laisser un commentaire