我想使用傳遞給unins000.exe. 我已經為安裝程式實作了它,但由于某種原因它不適用于卸載程式。
這是 Inno 設定腳本:
[Run]
Filename: "{app}\resources\app\Setup\install.bat"; \
Parameters: "python-3.10.7-amd64.exe {param:pysetup|standard}"
[UninstallRun]
Filename: "{app}\resources\app\Setup\uninstall.bat"; \
Parameters: "python-3.10.7-amd64.exe {param:ole|2} {param:defxml|2} {param:pywin|2} {param:python|2}"
注意:該Run部分有效 ( setup.exe /pysetuptype=...),但該UninstallRun部分無效 ( unins000.exe /ole=... /defxml=... /pywin=... /python=...)
這是我的uninstall.bat腳本:
@ECHO OFF
:OLE
IF "%2"=="1" GOTO :UNINOLE
IF "%2"=="0" GOTO :DEFXML
SET /p answer=Do you want to uninstall oletools? Y / N
IF /i %answer:~,1% EQU Y GOTO :UNINOLE
IF /i %answer:~,1% EQU N GOTO :DEFXML
ECHO [Y]es / [N]o
GOTO OLE
:UNINOLE
ECHO Y | pip uninstall oletools[full]
ECHO.
:DEFXML
IF "%3"=="1" GOTO :UNINDEF
IF "%3"=="0" GOTO :PYWIN
SET /p answer=Do you want to uninstall defusedxml? Y / N
IF /i %answer:~,1% EQU Y GOTO :UNINDEF
IF /i %answer:~,1% EQU N GOTO :PYWIN
ECHO [Y]es / [N]o
GOTO DEFXML
:UNINDEF
ECHO Y | pip uninstall defusedxml
ECHO.
:PYWIN
IF "%4"=="1" GOTO :UNINPYWIN
IF "%4"=="0" GOTO :UNINPY
SET /p answer=Do you want to uninstall pywin32? Y / N
IF /i %answer:~,1% EQU Y GOTO :UNINPYWIN
IF /i %answer:~,1% EQU N GOTO :UNINPY
ECHO [Y]es / [N]o
GOTO PYWIN
:UNINPYWIN
ECHO Y | pip uninstall pywin32
ECHO.
:UNINPY
IF "%5"=="1" START /WAIT %1 /uninstall /passive EXIT
IF "%5"=="0" EXIT
SET /p answer=Do you want to run the Setup for Python v.3.10.7 to uninstall Python? Y / N
IF /i %answer:~,1% EQU Y GOTO :PYSETUP
IF /i %answer:~,1% EQU N EXIT
ECHO [Y]es / [N]o
GOTO UNINPY
:PYSETUP
ECHO.
ECHO python-3.10.7-amd64.exe will start now
START /WAIT %1
EXIT
我必須改變什么才能使它起作用?
uj5u.com熱心網友回復:
該部分中的常量在UninstallRun安裝時決議。不在卸載時間。
如果您需要使用卸載時間引數,您可以在 Pascal 腳本中使用Exec并ExpandConstant支持函式和CurUninstallStepChanged事件函式對其進行編碼。
[Run]
Filename: "{app}\resources\app\Setup\install.bat"; \
Parameters: "python-3.10.7-amd64.exe {param:pysetup|standard}"
[Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ResultCode: Integer;
Filename, Params: string;
begin
if CurUninstallStep = usUninstall then
begin
Filename := ExpandConstant('{app}\resources\app\Setup\uninstall.bat');
Params := ExpandConstant('python-3.10.7-amd64.exe {param:ole|2} {param:defxml|2} {param:pywin|2} {param:python|3}');
if not Exec(Filename, Params, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox(
'Uninstallation failed with code ' IntToStr(ResultCode),
mbError, MB_OK);
end;
end;
end.
相關問題:卸載程式中的 Inno Setup Scripted Constants
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/515748.html
