程序:Windows Xp sp2 垃圾清理器

优质
小牛编辑
135浏览
2023-12-01
对于以前的光盘一般都是用批处理来达到安装完相应的软件而清理掉的效果!
但可以看出用 NSIS 同样也可以实现。

当然也可以参考集成光盘安装时产生的垃圾简易清理器(批处理)
http://dreams8.com/viewthread.php?tid=789

其实批处理都能实现的,但用NSIS打包一下是不是更酷呢?

引用脚本的内容:

; 该脚本使用 HM VNISEdit 脚本编辑器向导产生

; 安装程序初始定义常量
!define PRODUCT_NAME "XP垃圾清理器"
!define /date PRODUCT_VERSION "%y%m%d"
!define PRODUCT_PUBLISHER "似水年华"
!define PRODUCT_WEB_SITE "http://www.Dreams8.com"
SetCompressor /SOLID lzma

; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------
!include "MUI.nsh"
!include "Sections.nsh"
!include "UsefulLib.nsh"

; MUI 预定义常量
!define MUI_ABORTWARNING
!define MUI_ICON "TEMP\bin_empty.ico"

; 欢迎页面
!define MUI_WELCOMEFINISHPAGE_BITMAP "temp\dreams8.bmp"
!insertmacro MUI_PAGE_WELCOME
; 许可协议页面
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "TEMP\Licence.txt"
; 组件选择页面(无组件选择界面)
!define MUI_COMPONENTSPAGE_NODESC
; 安装过程页面
!insertmacro MUI_PAGE_INSTFILES
; 安装完成页面
!insertmacro MUI_PAGE_FINISH

; 安装界面包含的语言设置
!insertmacro MUI_LANGUAGE "SimpChinese"

; 安装预释放文件
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

;安装界面下画线的文字
BrandingText "Http://www.Dreams8.com 似水年华"

;声明版权
VIProductVersion "2006.04.09.0"
VIAddVersionKey /LANG=2052 "ProductName" "XP垃圾清理器"
VIAddVersionKey /LANG=2052 "CompanyName" "WwW.Dreams8.CoM"
VIAddVersionKey /LANG=2052 "LegalTrademarks" "似水年华"
VIAddVersionKey /LANG=2052 "LegalCopyright" "(C) 2006 Dreams8.Com"
VIAddVersionKey /LANG=2052 "FileDescription" "XP垃圾清理器"
VIAddVersionKey /LANG=2052 "FileVersion" "${PRODUCT_VERSION}"
VIAddVersionKey /LANG=2052 "梦想吧" "Www.Dreams8.Com"

Name "${PRODUCT_NAME}${PRODUCT_VERSION}"
Caption "XP垃圾清理器 ${PRODUCT_VERSION} By似水年华"
OutFile "delete.exe"
ShowInstDetails nevershow

Section "-垃圾清理器"

;删除屏幕保护
  Delete  "$SYSDIR\scrnsave.scr"
  Delete  "$SYSDIR\ss3dfo.scr"
  Delete  "$SYSDIR\ssbezier.scr"
  Delete  "$SYSDIR\ssflwbox.scr"
  Delete  "$SYSDIR\ssmarque.scr"
  Delete  "$SYSDIR\ssmypics.scr"
  Delete  "$SYSDIR\ssmyst.scr"
  Delete  "$SYSDIR\sspipes.scr"
  Delete  "$SYSDIR\ssstars.scr"
  Delete  "$SYSDIR\sstext3d.scr"
;删除BMP
  Delete  "$WINDIR\Blue Lace 16.bmp"
  Delete  "$WINDIR\Coffee Bean.bmp"
  Delete  "$WINDIR\FeatherTexture.bmp"
  Delete  "$WINDIR\Gone Fishing.bmp"
  Delete  "$WINDIR\Greenstone.bmp"
  Delete  "$WINDIR\Prairie Wind.bmp"
  Delete  "$WINDIR\Rhododendron.bmp"
  Delete  "$WINDIR\River Sumida.bmp"
  Delete  "$WINDIR\Santa Fe Stucco.bmp"
  Delete  "$WINDIR\Soap Bubbles.bmp"
  Delete  "$WINDIR\Zapotec.bmp"
;删除JPGP
  Delete "$WINDIR\Web\Wallpaper\Ascent.jpg"
  Delete "$WINDIR\Web\Wallpaper\Autumn.jpg"
  Delete "$WINDIR\Web\Wallpaper\Azul.jpg"
  Delete "$WINDIR\Web\Wallpaper\Crystal.jpg"
  Delete "$WINDIR\Web\Wallpaper\Follow.jpg"
  Delete "$WINDIR\Web\Wallpaper\Friend.jpg"
  Delete "$WINDIR\Web\Wallpaper\Home.jpg"
  Delete "$WINDIR\Web\Wallpaper\Moon flower.jpg"
  Delete "$WINDIR\Web\Wallpaper\Peace.jpg"
  Delete "$WINDIR\Web\Wallpaper\Power.jpg"
  Delete "$WINDIR\Web\Wallpaper\Purple flower.jpg"
  Delete "$WINDIR\Web\Wallpaper\Radiance.jpg"
  Delete "$WINDIR\Web\Wallpaper\Red moon desert.jpg"
  Delete "$WINDIR\Web\Wallpaper\Ripple.jpg"
  Delete "$WINDIR\Web\Wallpaper\Stonehenge.jpg"
  Delete "$WINDIR\Web\Wallpaper\Ripple.jpg"
  Delete "$WINDIR\Web\Wallpaper\Tulips.jpg"
  Delete "$WINDIR\Web\Wallpaper\Vortec space.jpg"
  Delete "$WINDIR\Web\Wallpaper\Wind.jpg"
  Delete "$WINDIR\Web\Wallpaper\Windows XP.jpg"
;清除补丁临时安装文件夹
  RMDir /r /REBOOTOK "$WINDIR\SVCPACK"
  SetAutoClose false
SectionEnd

;定义关于按钮及一个网页跳转!
!define IDC_ABOUT    1300
!define IDC_LINK    1301
!define IDM_ABOUT    1

Function .onPageCallback
    ${If} $MSG = ${WM_INITDIALOG}
        Push $0
        Push $1
        Push $2
        Push $3
        ${GetDlgItemRect} $0 $1 $2 $3 $HWNDPARENT ${IDC_CANCEL}
        IntOp $0 $2 - $0
        IntOp $2 $3 - $1
        ${CreateButton} "关于(&A)" 20 $1 $0 $2 $HWNDPARENT ${IDC_ABOUT}
        IntOp $3 $0 + 30
        IntOp $1 $1 + 3
        IntOp $2 $2 - 2
        ${CreateLink} $3 $1 90 $2 $HWNDPARENT ${IDC_LINK}
        ${GetSystemMenu} $0 $HWNDPARENT
        ${AppendMenu} $0 ${MF_SEPARATOR} 0 0
        ${AppendMenu} $0 ${MF_STRING} ${IDM_ABOUT} "关于安装程序(&A)"
        Pop $3
        Pop $2
        Pop $1
        Pop $0
    ${ElseIf} $MSG = ${WM_COMMAND}
        ${If} $WPARAM = ${IDC_ABOUT}
            ${MessageBox2} `==================$\n\
                             ===Windows Xp sp2 垃圾清理器===$\n\
                            ==================$\n\
                            感谢你使用这个XP垃圾清理器,希望能$\n\
                            给您带来方便.同时也欢迎您常来梦想吧$\n\
                            WWW.DREAMS8.COM逛逛,似水年华在此 $\n\
                            谢谢各位的支持,我相信我们会做得更好! \
                        $\n$\n                梦想吧|似水年华2006年4月9日` `关于 $(^NameDA)` ${MB_OK}|${MB_ICONINFORMATION}
        ${ElseIf} $WPARAM = ${IDC_LINK}
            ExecShell open `http://www.dreams8.com/`
        ${EndIf}
    ${ElseIf} $MSG = ${WM_DRAWITEM}
        ${DrawLink} `访问梦想吧` ${IDC_LINK} $LPARAM
    ${ElseIf} $MSG = ${WM_SYSCOMMAND}
        ${If} $WPARAM = ${IDM_ABOUT}
            ${MessageBox2} `梦想吧|Dreams8 WWW.DREAMS8.COM$\n版权所有 (C) 2006 似水年华$\n$\n梦想吧主页:$\nhttp://www.dreams8.com/` `关于安装程序` ${MB_OK}|${MB_ICONINFORMATION}
        ${EndIf}
    ${EndIf}
FunctionEnd

具体要删掉什么垃圾可以自己加入,比如删掉收藏夹里的一些没有用的链接之类的!

点击另存资源文件