在Inno Setup中使用RegQueryStringValue检索环境变量 [英] Retrieve environment variable using RegQueryStringValue in Inno Setup

查看:811
本文介绍了在Inno Setup中使用RegQueryStringValue检索环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用RegQueryStringValue在安装过程中检索环境变量,

I am trying to retrieve an environment variable during installation using RegQueryStringValue,

我正在使用以下代码

[Setup]
DefaultGroupName="{code:GetPath}"

[Code]
function GetPath(Value: String): String;
var
  OrigPath: string;
begin
  if RegQueryStringValue(HKLM, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'GCC', OrigPath) then
  Result := OrigPath;
end;

但是安装程序在安装过程中给我一个错误,

But the installer gives me an error during installation,

有人可以告诉我为什么或可以代替我做什么吗?

Can someone tell me why or what I can use instead?

推荐答案

对于此问题,您尝试使用DefaultGroupName而不是DefaultDirName来导致错误.

In the case of this question, you're trying to use DefaultGroupName instead of DefaultDirName which is causing the errors.

这篇关于在Inno Setup中使用RegQueryStringValue检索环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆