我必须创建一个Inno安装脚本,使用正斜杠而不是反斜杠将{app}路径写入注册表
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName:"APP_HOME"; ValueData:"{app}"; Flags: preservestringtype
如何使用正斜杠获取{app}值(默认情况下,inno用反斜杠写)?
答案 0 :(得分:2)
您必须为{code:}
脚本常量制作自定义函数,例如这样:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "APP_HOME"; ValueData: {code:GetRegistryData}; Flags: preservestringtype
[Code]
function GetRegistryData(Value: string): string;
begin
Result := ExpandConstant('{app}');
StringChangeEx(Result, '\', '/', True);
end;