如何通过以下方法使Inno Setup禁用 CreateUninstallRegKey 代码?
How do you make Inno Setup disable CreateUninstallRegKey via code?
我在Inno Setup中创建的 setup.exe 文件接受参数,例如:
My setup.exe file created in Inno Setup accepts parameters, e.g.:
setup.exe -a或
setup.exe -b如果提供了-a参数,则启用CreateUninstallRegKey;如果提供了-b参数,则禁用CreateUninstallRegKey.
If -a parameter is supplied, then enable CreateUninstallRegKey, or if -b parameter is supplied, then disable CreateUninstallRegKey.
反正是通过代码设置CreateUninstallRegKey还是我必须先创建一个函数然后在脚本部分中调用该函数?
Is there anyway to set CreateUninstallRegKey via code or do I have to make a function then call the function in script section?
此帮助页面说明了有关使用{code:...}常量的信息,但不幸的是,我遇到了此错误:
This help page explains about using {code:...} constants, but unfortunately I got this error:
谢谢
推荐答案请勿使用{code:}表达式将值传递给布尔类型指令.这样做:
Do not use the {code:} expression for passing values to Boolean type directives. Do it this way:
[Setup] AppName=My Program AppVersion=1.5 DefaultDirName={pf}\My Program CreateUninstallRegKey=NeedsUninstallRegKey [Code] function CmdLineParamExists(const Value: string): Boolean; var I: Integer; begin Result := False; for I := 1 to ParamCount do if CompareText(ParamStr(I), Value) = 0 then begin Result := True; Exit; end; end; function NeedsUninstallRegKey: Boolean; begin Result := CmdLineParamExists('-a'); end;更多推荐
通过代码将卸载注册表项设置为条件
发布评论