NSIS script to launch apps from any source

Share interesting information or links related to portable apps here.
Post Reply
Message
Author
User avatar
insert_nick
Posts: 6
Joined: Sat Jul 08, 2006 6:10 am

NSIS script to launch apps from any source

#1 Post by insert_nick »

Hi, I've made a little NSIS script which helps a lot if you need to launch any application without knowing the drive letter it is launched from. Here it is, hope it helps someone figuring out how to do that:

Code: Select all

Name "Launcher"
OutFile "launcher.exe"
ShowInstDetails nevershow
AutoCloseWindow True

Section "Main"

  ; set the active directory
  SetOutPath $EXEDIR\the\dir\we\want\to\go\in
  
  ; set an environment variable [ use: i("variable_name", "variable_value").r0 ]
  System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("THE_VARIABLE", "$EXEDIR\a\dir\we\want\as\environment\variable").r0'
 
  ; ...
  ; add as many environment variables as you need like specified above
  ; ...
  
  ; execute program
  Exec '"the_program_executable.exe"'
  
  ; ...or execute program with parameters    
  ; Exec '"the_program_executable.exe" /settings "some_eventual_parameters_to_append_after_the_exe_name"'

SectionEnd


User avatar
nycjv321
Posts: 181
Joined: Wed Feb 15, 2006 12:42 pm

umm...

#2 Post by nycjv321 »

if its not to hard to ask can u post an example of an app you have used this for.

User avatar
insert_nick
Posts: 6
Joined: Sat Jul 08, 2006 6:10 am

Re: umm...

#3 Post by insert_nick »

nycjv321 wrote:if its not to hard to ask can u post an example of an app you have used this for.
I used it to load the Opera browser from a CD-ROM.

Post Reply