2016-03-01 35 views
0

我想製作一個自解壓exe(abcdInstaller.exe),它運行另一個exe(AppInstaller.apk,這是在我的電腦上安裝abcd.apk)。下面的腳本工作正常,但當我運行abcdInstaller.exe時,它也提取當前目錄中的這兩個文件(從我運行此exe文件)並運行AppInstaller.exe。如何使用NSIS製作自解壓exe文件?

但我想要什麼,用戶只需點擊abcdInstaller.exe和abcdInstaller.exe將在後臺運行AppInstaller.exe,這將完成其工作。

!include LogicLib.nsh 
!include WinMessages.nsh 


SilentInstall silent 
RequestExecutionLevel user ;no elevation needed for this test 
ShowInstDetails hide 

# this will be the created executable archive 
OutFile "abcdInstaller.exe" 

InstallDir $EXEDIR 

# the executable part 
Section 

# define the output path for the following files 
SetOutPath $INSTDIR 

# define what to install and place it in the output path... 
# ...app... 
File AppInstaller.exe 
# ...and the library. 
File abcd.apk 

# run application 
ExecShell "open" "AppInstaller.exe" 

# done 
SectionEnd 

我試着評論SetOutPath $ INSTDIR,但沒有任何反應。

請給出一些建議。

回答

0

您應該使用$ PLUGINSDIR對於在安裝過程中臨時使用的文件:

SilentInstall silent 
RequestExecutionLevel user 
OutFile "Test.exe" 

Section 
InitPluginsDir 
SetOutPath $PluginsDir 
File "MyApp.exe" 
ExecWait '"$PluginsDir\MyApp.exe"' ; Double quotes on the path 

SetOutPath $Temp ; SetOutPath locks the directory and we don't want to lock $PluginsDir 
SectionEnd 
0

我正在更新我的解決方案。

我正在將exe複製到臨時文件夾,並在完成該過程後刪除該文件夾。

!include LogicLib.nsh 
!include WinMessages.nsh 


SilentInstall silent 
RequestExecutionLevel user ;no elevation needed for this test 
ShowInstDetails hide 

# this will be the created executable archive 
OutFile "ABCD.exe" 

InstallDir $EXEDIR 


# the executable part 
Section 

# define the output path for the following files 
SetOutPath $TEMP\ApkPath 

# define what to install and place it in the output path... 
# ...your app... 
File AppInstaller.exe 
# ...and the library. 
File xyz.apk 

# run your application 
ExecWait "$TEMP\ApkPath\AppInstaller.exe" 

SetOutPath $TEMP 

RMDir /r $TEMP\ApkPath 

# done 
SectionEnd 
相關問題