在IS新聞組中建議使用/ D =,但使用版本5.2.3附帶的iscc.exe,我得到一個「未知選項:」錯誤。如何將參數傳遞給Inno Setup命令行編譯器?
然後在腳本中,你如何使用命令行參數的值?
在IS新聞組中建議使用/ D =,但使用版本5.2.3附帶的iscc.exe,我得到一個「未知選項:」錯誤。如何將參數傳遞給Inno Setup命令行編譯器?
然後在腳本中,你如何使用命令行參數的值?
從Inno Setup的幫助文件:
Inno Setup的預處理器替換 標準Inno Setup的命令行編譯器 (ISCC.exe)通過擴展 版本。這個擴展版本 提供了額外的參數來控制 Inno Setup Preprocessor。
「額外參數」包含/ d選項。
正如MicSim所說,您的確需要預處理器。它包含在最新的ISPack中。一旦安裝,iscc支持/ D。
然後可以使用這樣定義的值(假設你做/DVERSION_NAME=1.23):
AppVerName=MyApplication v{#VERSION_NAME}
現在內置於Inno Setup 5,因此您無需下載任何額外的包裝。 – 2012-08-10 14:44:45
這不是文檔的一部分。請在這裏包含一些有用的信息:http://www.jrsoftware.org/ishelp/index.php?topic=setupcmdline – vezenkov 2015-07-29 05:22:42
如果你想從INNO代碼解析命令行參數,然後用類似的方法對此。只需調用命令行的INNO腳本如下:
C:\MyInstallDirectory>MyInnoSetup.exe -myParam parameterValue
然後你就可以調用GetCommandLineParam這樣無論你需要它:
myVariable := GetCommandLineParam('-myParam');
// ========= ================================================== =======
{ Allows for standard command line parsing assuming a key/value organization }
function GetCommandlineParam (inParam: String):String;
var
LoopVar : Integer;
BreakLoop : Boolean;
begin
{ Init the variable to known values }
LoopVar :=0;
Result := '';
BreakLoop := False;
{ Loop through the passed in arry to find the parameter }
while ((LoopVar < ParamCount) and
(not BreakLoop)) do
begin
{ Determine if the looked for parameter is the next value }
if ((ParamStr(LoopVar) = inParam) and
((LoopVar+1) < ParamCount)) then
begin
{ Set the return result equal to the next command line parameter }
Result := ParamStr(LoopVar+1);
{ Break the loop }
BreakLoop := True;
end
{ Increment the loop variable }
LoopVar := LoopVar + 1;
end;
end;
希望這有助於...
感謝所有的答案。一切都很有幫助。我討厭挑選一個作爲首選答案。 – AlanKley 2009-02-04 23:52:22