Page 1 of 1

NSIS script to launch apps from any source

Posted: Thu Jul 20, 2006 2:47 am
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


umm...

Posted: Thu Jul 20, 2006 6:30 am
by nycjv321
if its not to hard to ask can u post an example of an app you have used this for.

Re: umm...

Posted: Thu Jul 20, 2006 6:47 am
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.