今天收到要將Windows OS 裡面startup(啟動)內的資料刪除的指令於是製作了一刪除程式

 

其程式敘述如下


[Run]
Filename: {app}\unins000.exe; WorkingDir: {app}; Flags: shellexec runhidden; Parameters: "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART";

[UninstallDelete] ;Type: files; Name:"{userstartup}\RS232.vbs"
;Type: files; Name:"{commonstartup}\aaa.txt"

[code]
//刪除file
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
//if MsgBox('是否同意移除', mbConfirmation, MB_YESNO) = IDYES then
//確定移除
//DeleteFile(ExpandConstant('{win}\Downloaded Program Files\chysoftPrinter.dll'));
//DeleteFile(ExpandConstant('{win}\Downloaded Program Files\chysoftPrinter.inf'));
DeleteFile(ExpandConstant('{userstartup}\RS232.lnk'));
DeleteFile(ExpandConstant('{commonstartup}\RS232.lnk'));
end;
[/code]

 

簡單述說:

unins000.exe   //由inno setup產生

所以我們需要執行他才可以不留下痕跡(執行流程: 安裝->移除)

 

/VERYSILENT /SUPPRESSMSGBOXES /NORESTART

透過他可以達成靜默安裝(當使用者安裝完畢,同時也移除完畢了)

 

DeleteFile(ExpandConstant('{userstartup}\RS232.lnk'));

透過此函式可以刪除file

 

{userstartup}

此變數代表著 user的"啟動目錄"

 

{commonstartup}

此變數代表著 共用的"啟動目錄"

 

 

參考資料:

http://blog.wanwan722.com/2008/12/inno-setup-windows.html

http://blog.csdn.net/cy_5214/article/details/7571348

 

 

arrow
arrow
    創作者介紹
    創作者 ooieueioo 的頭像
    ooieueioo

    ooieueioo的部落格

    ooieueioo 發表在 痞客邦 留言(0) 人氣()