Old 1st March 2016, 18:17   #1
viveknuna
Junior Member
 
Join Date: Feb 2016
Posts: 4
How to make self extracting exe ?

Hi,

I want to make a self extracting exe(abcdInstaller.exe), which runs another exe(AppInstaller.apk, this is installing abcd.apk on my pc). Below script works fine but when I run abcdInstaller.exe, it also extracts these two files on current directory(from where I'm running this exe) and runs the AppInstaller.exe.

But What I want, User just click on abcdInstaller.exe and abcdInstaller.exe will run AppInstaller.exe in background, which will do its work.



!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


I tried to comment SetOutPath $INSTDIR, but then nothing happens.

Please give some suggestions.
viveknuna is offline   Reply With Quote
Old 1st March 2016, 19:55   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 859
So instead of using InstallDir, you want to "install" to a temp directory. Something like this:

PHP Code:
Section

InitPluginsDir
SetOutPath 
"$PLUGINSDIR"

File AppInstaller.exe
File abcd
.apk

ExecWait 
"$PLUGINSDIR\AppInstaller.exe"

SetOutPath $temp don't lock %pluginsdir

SectionEnd 
Depending on the installer being run, ExecWait might not be enough.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile

Last edited by Anders; 1st March 2016 at 20:25. Reason: Don't lock pluginsdir
JasonFriday13 is offline   Reply With Quote
Old 2nd March 2016, 07:31   #3
viveknuna
Junior Member
 
Join Date: Feb 2016
Posts: 4
Thanks Jason,

Your script works, But I have also done in the same way.

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
viveknuna is offline   Reply With Quote
Old 3rd March 2016, 02:49   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 859
The reason why we use $PLUGINSDIR is because it's automatically removed when the installer exits, so you don't have to use RMDir /r "$TEMP\thisdir".

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
nsis

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump