我想在使用inno设置的每个用户的user / My Documents中添加我的设置,但它不适用于我。
这里我提供你的iis文件。 提前致谢。 请帮帮我。
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Testing"
#define MyAppVersion "1.0"
#define MyAppPublisher "Test"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "testing.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{200DC169-9647-4295-91B4-B1D1D8482B82}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;DefaultDirName={userdocs}\test
DefaultDirName={code:DefDirRoot}\test
DisableDirPage=yes
DefaultGroupName=test
DisableProgramGroupPage=yes
AllowNoIcons=yes
LicenseFile=C:\Users\abc\Desktop\final product\licence.txt
OutputDir=C:\Users\abc\Documents\test
OutputBaseFilename=VL-PI Setup
SetupIconFile=C:\Users\abc\Downloads\clientcommentsveryimp\CORRECTIONS_TO_INSTALLER_BUGS\CORRECTIONS_TO_INSTALLER_BUGS\Icon\icon.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Dirs]
Name: "{app}\Graphics"
Name: "{app}\lib"
[Files]
Source: "C:\test work\agriculture project requirments\jre-6u2-windows-i586-p.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall;
Source: "D:\final product\30-01-2013\test.exe"; DestDir: "{app}"; Flags: ignoreversion;
Source: "C:\Users\test\Desktop\final product\Graphics\*"; DestDir: "{app}\Graphics"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\test\Desktop\final product\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\VL-PI"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:uninstallProgram,VL-PI}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}";check:InitializeSetup; Flags: nowait postinstall skipifsilent
[Code]
function Install_JavaFrameWork() : Boolean;
var
hWnd: Integer;
ResultCode: Integer;
dotnetRedistPath: string;
outVar : string;
begin
dotnetRedistPath:= ExpandConstant('{tmp}\jre-6u2-windows-i586-p.exe');
try
if Exec(dotnetRedistPath,'', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// ResultCode contains the exit code
case ResultCode of
// 1641 The requested operation completed successfully. The system will be restarted so the changes can take effect.
// 3010 The requested operation is successful. Changes will not be effective until the system is rebooted.
1641:
begin
Result := true;
end
3010, 0:
begin
Result := false;
end else // -> case default
begin
Result := true;
end
end;
end else
begin
//handle failure if necessary; ResultCode contains the error code
Result := false;
end;
except
ShowExceptionMessage;
end;
end;
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaInstalled : Boolean;
Result1 : Boolean;
Versions: TArrayOfString;
I: Integer;
begin
if RegGetSubkeyNames(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', Versions) then
begin
for I := 0 to GetArrayLength(Versions)-1 do
if JavaInstalled = true then
begin
//do nothing
end else
begin
if ( Versions[I][2]='.' ) and ( ( StrToInt(Versions[I][1]) > 1 ) or ( ( StrToInt(Versions[I][1]) = 1 ) and (
StrToInt(Versions[I][3]) >= 6 ) ) ) then
begin
JavaInstalled := true;
end else
begin
JavaInstalled := false;
end;
end;
end else
begin
JavaInstalled := false;
end;
//JavaInstalled := RegKeyExists(HKLM,'SOFTWARE\JavaSoft\Java Runtime Environment\1.9');
if JavaInstalled then begin
Result := true;
end
else begin
if FileExists(ExpandConstant('{tmp}\jre-6u2-windows-i586-p.exe')) then
begin
Log('File exists');
Result1 := MsgBox('This program requires Java Runtime Environment version 1.6 or newer.Do you want to install it now?',
mbConfirmation, MB_YESNO) = idYes;
if Result1 = false then begin
Result:=true;
end
else begin
Install_JavaFrameWork;
Result:=true;
end;
end else
begin
Result:=true;
end;
end;
end;
答案 0 :(得分:2)
管理员设置不应该尝试写入用户的个人资料,因为他们不能保证是您期望的用户,甚至可以从该计算机访问。
您目前正在使用PrivilegesRequired=none
,因此它不会切换用户,但这会阻止您为某些用户安装Java。
您应该将PrivilegesRequired=admin
用于正常安装,或PrivilegesRequired=lowest
用于特定于用户的安装。