gpt4 book ai didi

windows - ExpandConstant 函数似乎不适用于 Windows 7

转载 作者:可可西里 更新时间:2023-11-01 10:27:10 24 4
gpt4 key购买 nike

<分区>

我正在尝试使用此函数以便在运行时转换 {app} 变量。它在 Windows 2008(64 位)上运行良好,但在 Windows 7(64 位)上运行不佳。

这是我使用的代码:

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: ExpandConstant(NeedsAddPath('{app}'))



function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath)
then begin
Result := True;
exit;
end;
// look for the path with leading and trailing semicolon
// Pos() returns 0 if not found
Result := Pos(';' + UpperCase(Param) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
if Result = True then
Result := Pos(';' + UpperCase(Param) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
end;

你知道原因吗?

谢谢!

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com