使用NSIS卸载时如何保存日志?

问题描述 投票:0回答:1

我试图记录卸载过程,特别是被以下方法删除的文件和文件夹。rmdir 用于调试。然而,。LogSet OnDumpLog 功能似乎不能用。有谁知道有什么办法吗?

编辑一下

我在用DumpLog一样。

Section "Uninstall"
;ADD YOUR OWN FILES HERE...
  LogSet On
  DetailPrint "this is an uninstall test"
  Delete "$INSTDIR\Uninstall.exe"  
  DeleteRegKey /ifempty HKCU "Software\Test"
  DetailPrint "dumplog section"
  StrCpy $0 "$INSTDIR\install.log"
  Push $0
  Call un.DumpLog
SectionEnd

Function un.DumpLog
  Exch $5
  Push $0
  Push $1
  Push $2
  Push $3
  Push $4
  Push $6

  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1016
  StrCmp $0 0 exit
  FileOpen $5 $5 a
  StrCmp $5 "" exit
    SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
    System::Alloc ${NSIS_MAX_STRLEN}
    Pop $3
    StrCpy $2 0
    System::Call "*(i, i, i, i, i, i, i, i, i) i \
      (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
    loop: StrCmp $2 $6 done
      System::Call "User32::SendMessageA(i, i, i, i) i \
        ($0, ${LVM_GETITEMTEXT}, $2, r1)"
      System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
      FileWrite $5 "$4$\r$\n"
      IntOp $2 $2 + 1
      Goto loop
    done:
      FileClose $5
      System::Free $1
      System::Free $3
  exit:
    Pop $6
    Pop $4
    Pop $3
    Pop $2
    Pop $1
    Pop $0
    Exch $5
FunctionEnd  

更多编辑: 事情变得越来越复杂。

我的结构是这样的。

-InstDir
 -UnInstDir
  -Uninstaller.exe

当我运行卸载程序或使用 execwait $InstDir\UnInstDir\Uninstall.exe, LogSet On 工作,并且在UnInstDir中创建了一个新的install.log。

然而,当我使用 execwait $InstDir\UnInstDir\Uninstall.exe _?=$InstDir, LogSet On 不工作。

有谁有什么线索吗?

nsis
1个回答
0
投票

LogSet 要求你使用 构建NSIS的日志. DumpLog只写下你在InstFiles页面上看到的相同信息。

另一种方法是 在您安装文件时跟踪它们.

最后一个选择是使用 !system 执行一个脚本(批处理文件等),生成两个.nsh文件(一个用于安装程序,一个用于卸载程序),其内容为 FileDelete 的输出的指令。dir /s.

© www.soinside.com 2019 - 2024. All rights reserved.