NSIS脚本 - 下载.NET框架,DirectX(NSIS script - download .NET framework, DirectX)
NSIS脚本可以从microsoft下载.NET和DirectX,然后安装吗?
我不想将安装程序包含在我的安装程序中,因为它们非常庞大。
Can a NSIS script download .NET and DirectX from microsoft, then install it?
I don't want to include the installers in my installer because they are huge.
最满意答案
这是.Net的一个例子:
Function GetDotnet ;// looks for local copy before downloading, returns path in $0 Pop $0 ${If} ${FileExists} "$InitDir\dotnetfx35.exe" StrCpy $0 "$InitDir\dotnetfx35.exe" ${ElseIf} ${FileExists} "$InitDir\dotnetfx35setup.exe" StrCpy $0 "$InitDir\dotnetfx35setup.exe" ${Else} Call DownloadDotnet StrCpy $0 $0 ${EndIf} Push $0 FunctionEnd Function DownloadDotnet ;// downloads .Net, returns download path in $0 NSISDL::download "${DotnetDownloadUrl}" "${TempDir}\dotnetfx35setup.exe" Pop $0 ${If} $0 == "cancel" Quit ${EndIf} StrCpy $0 "${TempDir}\dotnetfx35setup.exe" Push $0 FunctionEnd Function InstallDotnet ;// kicks off the .Net installer Pop $0 Push $1 ExecWait '"$0" /norestart' $1 FunctionEndHere's an example for .Net :
Function GetDotnet ;// looks for local copy before downloading, returns path in $0 Pop $0 ${If} ${FileExists} "$InitDir\dotnetfx35.exe" StrCpy $0 "$InitDir\dotnetfx35.exe" ${ElseIf} ${FileExists} "$InitDir\dotnetfx35setup.exe" StrCpy $0 "$InitDir\dotnetfx35setup.exe" ${Else} Call DownloadDotnet StrCpy $0 $0 ${EndIf} Push $0 FunctionEnd Function DownloadDotnet ;// downloads .Net, returns download path in $0 NSISDL::download "${DotnetDownloadUrl}" "${TempDir}\dotnetfx35setup.exe" Pop $0 ${If} $0 == "cancel" Quit ${EndIf} StrCpy $0 "${TempDir}\dotnetfx35setup.exe" Push $0 FunctionEnd Function InstallDotnet ;// kicks off the .Net installer Pop $0 Push $1 ExecWait '"$0" /norestart' $1 FunctionEndNSIS脚本 - 下载.NET框架,DirectX(NSIS script - download .NET framework, DirectX)NSIS脚本可以从microsoft下载.NET和DirectX,然后安装吗?
我不想将安装程序包含在我的安装程序中,因为它们非常庞大。
Can a NSIS script download .NET and DirectX from microsoft, then install it?
I don't want to include the installers in my installer because they are huge.
最满意答案
这是.Net的一个例子:
Function GetDotnet ;// looks for local copy before downloading, returns path in $0 Pop $0 ${If} ${FileExists} "$InitDir\dotnetfx35.exe" StrCpy $0 "$InitDir\dotnetfx35.exe" ${ElseIf} ${FileExists} "$InitDir\dotnetfx35setup.exe" StrCpy $0 "$InitDir\dotnetfx35setup.exe" ${Else} Call DownloadDotnet StrCpy $0 $0 ${EndIf} Push $0 FunctionEnd Function DownloadDotnet ;// downloads .Net, returns download path in $0 NSISDL::download "${DotnetDownloadUrl}" "${TempDir}\dotnetfx35setup.exe" Pop $0 ${If} $0 == "cancel" Quit ${EndIf} StrCpy $0 "${TempDir}\dotnetfx35setup.exe" Push $0 FunctionEnd Function InstallDotnet ;// kicks off the .Net installer Pop $0 Push $1 ExecWait '"$0" /norestart' $1 FunctionEndHere's an example for .Net :
Function GetDotnet ;// looks for local copy before downloading, returns path in $0 Pop $0 ${If} ${FileExists} "$InitDir\dotnetfx35.exe" StrCpy $0 "$InitDir\dotnetfx35.exe" ${ElseIf} ${FileExists} "$InitDir\dotnetfx35setup.exe" StrCpy $0 "$InitDir\dotnetfx35setup.exe" ${Else} Call DownloadDotnet StrCpy $0 $0 ${EndIf} Push $0 FunctionEnd Function DownloadDotnet ;// downloads .Net, returns download path in $0 NSISDL::download "${DotnetDownloadUrl}" "${TempDir}\dotnetfx35setup.exe" Pop $0 ${If} $0 == "cancel" Quit ${EndIf} StrCpy $0 "${TempDir}\dotnetfx35setup.exe" Push $0 FunctionEnd Function InstallDotnet ;// kicks off the .Net installer Pop $0 Push $1 ExecWait '"$0" /norestart' $1 FunctionEnd
发布评论