某些系统文件,例如驱动,不重启无法删除。

利用windows注册表里的 RunOnce。注意必须在HKLM下,否则可能权限不够。

不能直接填cmd命令,要以cmd的参数形式填写。

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
     mres : integer;
begin
    case CurUninstallStep of                   
    usPostUninstall:
        begin
          mres := MsgBox('Do you want to remove the settings of xxx?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2);
          if mres = IDYES then
            DelTree(ExpandConstant('{commonappdata}\xxxFiles'), True, True, True);

          RegWriteStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\RunOnce', 'xxxUninstall', ExpandConstant('cmd.exe /c del {sys}\drivers\xxx.sys'));

       end;end;

 

相关文章:

  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2021-11-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-12-21
  • 2022-12-23
相关资源
相似解决方案