剧本
我创建了这个简单的脚本:
[ISPP]
; SignTool parameters
#define SignedDesc "$qxxx$q"
#define SignedPfx "$qxxx$q"
#define SignedTimeStamp "$qhttp://timestamp.verisign.com/scripts/timestamp.dll$q"
#define SignedPw "$qxxx$q"
#define AppURL "http://www.publictalksoftware.co.uk"
#define AppPublisher "Andrew Truckle"
[Setup]
DisableReadyPage=True
DisableReadyMemo=True
DisableFinishedPage=True
UsePreviousSetupType=False
UsePreviousTasks=False
UsePreviousLanguage=False
FlatComponentsList=False
AlwaysShowComponentsList=False
ShowComponentSizes=False
AppName=Public Talks Help Documentation
AppVersion=19.0.0
CreateAppDir=False
Uninstallable=no
OutputBaseFilename=PublicTalksHelpDocumentationSetup
SourceDir=D:\My Programs\2019\CommunityTalks\HelpNDoc\CHM
SignTool=SignTool /d {#SignedDesc} /du $q{#AppURL}$q /f {#SignedPfx} /p {#SignedPw} /t {#SignedTimeStamp} /v $f
AppId={{xxx}
[Files]
Source: "CommunityTalks.chm"; DestDir: "{app}"; Flags: ignoreversion正如你所看到的,这很简单。它被设计为由我的主要应用程序来执行。
测试
我决定通过使用批处理文件进行测试,尝试并模仿我的应用程序将要做的事情。以下是批处理文件命令:
PublicTalksHelpDocumentationSetup /SP- /VERYSILENT /DIR="C:\Program Files (x86)\Public Talks" /LOG=".\TestInstallLog.txt"结果
从表面上看,我认为它起作用了。我没有在屏幕上看到任何东西,只是被请求允许应用程序运行。但我无法在指定的DIR文件夹中找到该文件。
所以我又看了一遍日志:
2019-05-31 21:32:02.971 Log opened. (Time zone: UTC+01:00)
2019-05-31 21:32:02.971 Setup version: Inno Setup version 6.0.2 (u)
2019-05-31 21:32:02.971 Original Setup EXE: D:\My Programs\2019\CommunityTalks\HelpNDoc\CHM\Output\PublicTalksHelpDocumentationSetup.exe
2019-05-31 21:32:02.971 Setup command line: /SL5="$15002A,25665310,721408,D:\My Programs\2019\CommunityTalks\HelpNDoc\CHM\Output\PublicTalksHelpDocumentationSetup.exe" /SPAWNWND=$30900 /NOTIFYWND=$30914 /SP- /VERYSILENT /DIR="C:\Program Files (x86)\Public Talks" /LOG=".\TestInstallLog.txt"
2019-05-31 21:32:02.971 Windows version: 10.0.17763 (NT platform: Yes)
2019-05-31 21:32:02.972 64-bit Windows: Yes
2019-05-31 21:32:02.972 Processor architecture: x64
2019-05-31 21:32:02.972 User privileges: Administrative
2019-05-31 21:32:02.973 Administrative install mode: Yes
2019-05-31 21:32:02.973 Install mode root key: HKEY_LOCAL_MACHINE
2019-05-31 21:32:02.973 64-bit install mode: No
2019-05-31 21:32:02.979 Created temporary directory: C:\Users\ajtru\AppData\Local\Temp\is-1NT54.tmp
2019-05-31 21:32:03.227 Calling RestartManager's RmGetList.
2019-05-31 21:32:03.350 RmGetList finished successfully.
2019-05-31 21:32:03.350 RestartManager found no applications using one of our files.
2019-05-31 21:32:03.356 Starting the installation process.
2019-05-31 21:32:03.360 -- File entry --
2019-05-31 21:32:03.360 Dest filename: C:\WINDOWS\CommunityTalks.chm
2019-05-31 21:32:03.364 Time stamp of our file: 2019-05-30 18:35:24.000
2019-05-31 21:32:03.364 Installing the file.
2019-05-31 21:32:03.539 Successfully installed the file.
2019-05-31 21:32:03.539 Installation process succeeded.
2019-05-31 21:32:03.539 Need to restart Windows? No
2019-05-31 21:32:03.541 Deinitializing Setup.
2019-05-31 21:32:03.557 Log closed.注意到了?为什么要将它安装到文件夹中?
2019-05-31 21:32:03.360 Dest filename: C:\WINDOWS\CommunityTalks.chm
如何指定实际希望将文件安装到其中的文件夹?
更新
我发现了一个关于使用自定义参数的类似问题。所以我把它改成:
Source: "CommunityTalks.chm"; DestDir: "{param:InstallPath}"; Flags: ignoreversion我将命令行从使用DIR调整为InstallPath,但是IMHO DIR应该足够了。
替代方案
我想我可以用这个Pascal脚本,也许可以用它?然后我就不需要传递文件夹了:
// Returns the path where the program was last installed
function GetPathInstalled( AppID: String ): String;
var
sPrevPath: String;
begin
sPrevPath := '';
if not RegQueryStringValue( HKLM,
'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1',
'Inno Setup: App Path', sPrevpath) then
RegQueryStringValue( HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1' ,
'Inno Setup: App Path', sPrevpath);
Result := sPrevPath;
end;因为我知道那个应用程序的id。如果他们移动程序或其他什么的话,传递它的好处就能满足他们的需要。但我的问题仍然存在,关于DIR的失败。
发布于 2019-06-03 07:39:18
如果将此设置为“
{app}”,则不会为应用程序创建任何目录,将不会显示“选择目标位置向导”页面,并且{win}目录常量等效于{win}目录常量。
https://stackoverflow.com/questions/56401562
复制相似问题