我的 Inno Setup 脚本中有以下代码:
[Files]
Source: "C:\Users\Myname\Documents\Visual Studio
2010\Redistributional\vcredist_x86.exe"; DestDir: "{tmp}"; Flags:
deleteafterinstall;
Source: "C:\Users\Myname\Documents\Visual Studio
2010\Redistributional\vcredist_x64.exe"; DestDir: "{tmp}"; Flags:
deleteafterinstall;
[Run]
Filename: "{tmp}\vcredist_x86.exe"; Parameters: "/install /passive"; Check:
not IsWin64 and not VCinstalled32
Filename: "{tmp}\vcredist_x64.exe"; Parameters: "/install /passive"; Check:
IsWin64 and not VCinstalled64
Filename: "{app}\Myprogram.exe"; Description {cm:LaunchProgram,Myprogram}";
[Code]
function VCinstalled32: Boolean;
var
installed: Cardinal;
key: String;
begin
Result := False;
key := 'SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86';
if DirExists
('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86')
then begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, key, 'Installed', installed)
then begin
if installed = 1 then begin
Result := True;
end;
end;
end;
end;
function VCinstalled64: Boolean;
var
installed: Cardinal;
key: String;
begin
Result := False;
key := 'SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64';
if DirExists
('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64')
then begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, key, 'Installed', installed)
then begin
if installed = 1 then begin
Result := True;
end;
end;
end;
end;
我试图在目录HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64
不存在的 64 位 Windows 10 机器上运行它,但我收到一条错误消息,提示找不到 MSVCR100。
提前致谢。
更新
非常感谢您的回答,但我仍然收到相同的错误消息。也许我忽略了一些东西。
更新
我对 Inno 脚本不是很熟悉,也不知道如何记录结果。我试图用谷歌搜索后者,但它似乎很复杂,所以如果我无法以任何其他方式找到答案,我会尝试等待稍后。
更新
以下是日志文件的一些输出:
2018-03-05 14:01:03.567 -- File entry --
2018-03-05 14:01:03.568 Dest filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x86.exe
2018-03-05 14:01:03.568 Time stamp of our file: 2018-02-18 14:27:32.000
2018-03-05 14:01:03.568 Installing the file.
2018-03-05 14:01:04.016 Successfully installed the file.
2018-03-05 14:01:04.017 -- File entry --
2018-03-05 14:01:04.018 Dest filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x64.exe
2018-03-05 14:01:04.018 Time stamp of our file: 2018-02-18 16:00:00.000
2018-03-05 14:01:04.018 Installing the file.
2018-03-05 14:01:04.937 Successfully installed the file.
2018-03-05 14:01:08.883 -- Run entry --
2018-03-05 14:01:08.883 Run as: Current user
2018-03-05 14:01:08.883 Type: Exec
2018-03-05 14:01:08.883 Filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x64.exe
2018-03-05 14:01:08.883 Parameters: /install /passive
2018-03-05 14:01:21.800 Process exit code: 0
2018-03-05 14:01:21.800 -- Run entry --
2018-03-05 14:01:21.800 Run as: Current user
2018-03-05 14:01:21.800 Type: Exec
2018-03-05 14:01:21.800 Filename: C:\Program Files (x86)\Myfile\myfile.exe
2018-03-05 14:01:28.020 Process exit code: 3221225781
2018-03-05 14:01:28.023 Need to restart Windows? No
2018-03-05 14:01:30.504 Deinitializing Setup.
2018-03-05 14:01:30.593 Log closed.
据我了解, Process exit code: 0
意味着文件已成功执行,所以我仍然不明白可能出了什么问题。