Hi,
does anyone know a how to set the INSTDIR to be the root drive (like C:\ or D:\ depending on where the Windows has been installed). I try to find a variable for this, but I only found $WINDIR or $SYSDIR. I need to use a variable instead of just type hardcoded value C:\
root drive as INSTDIR
7 posts
Might no work under 98/ME
Works in all Windows versionsOutFile 'test.exe'
ShowInstDetails show
AllowRootDirInstall true
page directory
page instfiles
Function .onInit
ReadEnvStr $INSTDIR SYSTEMDRIVE
FunctionEnd
Section "boo"
SetOutPath "$INSTDIR"
SectionEnd
OutFile 'test.exe'
ShowInstDetails show
AllowRootDirInstall true
page directory
page instfiles
Function .onInit
StrCpy $INSTDIR "$WINDIR" 2
FunctionEnd
Section "boo"
SetOutPath "$INSTDIR"
SectionEnd
Re: root drive as INSTDIR
with $WINDIR and the GetRoot macro, you should be able to retrieve the root drive.
Now, I'm not sure that it's good practice to set the INSTDIR to the rootdrive. 😳
KenA
Originally posted by aditu.gHi,
Hi,
does anyone know a how to set the INSTDIR to be the root drive (like C:\ or D:\ depending on where the Windows has been installed). I try to find a variable for this, but I only found $WINDIR or $SYSDIR. I need to use a variable instead of just type hardcoded value C:\
with $WINDIR and the GetRoot macro, you should be able to retrieve the root drive.
Now, I'm not sure that it's good practice to set the INSTDIR to the rootdrive. 😳
KenA
Yes, I can use one of the solution posted above, but both are not allowed to be used outside sections.
I would like to define the InstallDir as "%rootdrive%\my application" and then on installation time if the person who install it want, to be possible to change.
I have attached the script to be more specific.
I would like to define the InstallDir as "%rootdrive%\my application" and then on installation time if the person who install it want, to be possible to change.
I have attached the script to be more specific.
Originally posted by aditu.g
Yes, I can use one of the solution posted above, but both are not allowed to be used outside sections.
I would like to define the InstallDir as "%rootdrive%\my application" and then on installation time if the person who install it want, to be possible to change.
I have attached the script to be more specific.
!define MY_APP "My application Name"
OutFile 'test.exe'
ShowInstDetails show
AllowRootDirInstall true
page directory
page instfiles
Function .onInit
StrCpy "$INSTDIR" "$WINDIR" 2
StrCpy "$INSTDIR" "$INSTDIR\${MY_APP}"
FunctionEnd
Section "boo"
SetOutPath "$INSTDIR"
SectionEnd
Done. I get rid of the InstallDir and use only $INSTDIR. It seems that it is used also on the choose directory page so it better like this. Sorry to waste forum space for such stupid question, but this root installation poped out with Vista. NSIS installer is able to do the installation using RequestExecutionLevel admin but then if you install the app on program files and on runtime wants to write there it will not work, that's why I wanted to install it on the system root (not directly there but in a folder 🙂