|
|
@Echo off
color 0a
cd /d .\
if exist "notepad2.exe" goto start
Echo "没有找到当前目录下的 NotePad2.exe,无法替换!"
pause
exit
:start
Echo /******************************************************
Echo 执行该脚本将替换系统记事本为当前目录下的 NotePad2.exe
Echo ******************************************************/
Echo 要退出请直接关闭本窗口!
pause
if NOT exist "%SystemRoot%\notepad.exe" goto 2
Echo 找到系统记事本,备份到 BackUp 子文件夹中!
if NOT exist ".\BackUp\" md ".\BackUp\"
if exist ".\BackUp\notepad.exe" echo 备份文件已经存在 BackUp 中,是否替换?
xcopy "%SystemRoot%\notepad.exe" ".\BackUp\"
goto beginrename
:2
if NOT exist "%SystemRoot%\notepad.exe" goto 3
Echo 找到系统记事本,备份到 BackUp 子文件夹中!
if NOT exist ".\BackUp\" md ".\BackUp\"
if exist ".\BackUp\notepad.exe" echo 备份文件已经存在 BackUp 中,是否替换?
xcopy "%SystemRoot%\system32\notepad.exe" ".\BackUp\"
goto begincopy
:3
Echo "没有找到系统记事本!"
:beginrename
if NOT exist ".\notepad.exe" goto begincopy
echo notepad.exe 已经存在当前目录中,是否删除?
del /P ".\notepad.exe"
:begincopy
rename notepad2.exe notepad.exe
if NOT exist "%SystemRoot%\notepad.exe" goto SystemRoot
echo 确认替换文件:
:SystemRoot
xcopy notepad.exe "%SystemRoot%\"
if NOT exist "%SystemRoot%\system32\notepad.exe" goto SystemRoot
echo 确认替换文件:
:SystemRoot
xcopy notepad.exe "%SystemRoot%\system32\"
if NOT exist "%SystemRoot%\system32\dllcache\notepad.exe" goto dllcache
echo 确认替换文件:
:dllcache
xcopy notepad.exe "%SystemRoot%\system32\dllcache\"
rename notepad.exe notepad2.exe
Echo 替换完成!
pause |
|