您好,我正在为我正在使用的安装程序使用 Inno Setup(基于 Delphi)。我只想将用户名放入字符串中: 我的代码:
var
usrname: string;
begin
usrname := GetEnvironmentVariable('USERNAME');
end;
当我尝试编译我的代码时,总是出现以下错误消息:
Unknown identifier 'GetEnvironmentVariable'
我做错了什么?我是 Delphi 的新手,所以正确的方法可能很明显。
最佳答案
您要查找的函数称为 GetEnv
在 Inno Setup 中,修复您的代码,例如这样:
var
UserName: string;
begin
UserName := GetEnv('USERNAME');
end;
关于environment-variables - GetEnvironmentVariable 在 Inno Setup (Delphi) 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20165453/