; Script generated by the HM NIS Edit Script Wizard.
var str4500
var str4501
var str4700
var strProductName
!include "logiclib.nsh"
!include "FileFunc.nsh"
Name "DC系列"
OutFile "Setup.exe"
SilentInstall silent
AutoCloseWindow true
ShowInstDetails nevershow
Section "MainSection" SEC01
通过命令行设置需要安装的产品名称和安装路径
push $R0
push $R1
push $R2
获取命令行参数,形式:-product=“DC-4501” -path="D:\TEMP"
${Getparameters} $R0
解析参数数据
${GetOptions} $R0 "-Product=" $R1
${GetOptions} $R0 "-Path=" $R2
pop $R0
设置安装路径
StrCpy $INSTDIR "$R2"
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "D:\NsisPackage\公共文件.txt"
StrCpy $strProductName $R1
${if} $R1 == $str4500
File /r "D:\NsisPackage\DC-4500"
${elseif} $R1 == $str4501
File /r "D:\NsisPackage\DC-4501"
${elseif} $R1 == $str4700
File /r "D:\NsisPackage\DC-4700"
${endif}
pop $R1
pop $R2
SectionEnd
Function .onInit
Call SetString
Functionend
Function SetString
StrCpy $str4500 "DC-4500"
StrCpy $str4501 "DC-4501"
StrCpy $str4700 "DC-4700"
FunctionEnd
网友评论