Skip to content
⌘ NSIS Forum Archive

How can we install to c:\dir ????

6 posts

DarkLord23#

How can we install to c:\dir ????

Hello,

I would like to propose the following dir for my installation:

C:\econf

where c:\ is the system dir (so I could be d:\ for a multiboot OS, etc.)

I have seen this function:

StrCpy $0 $WINDIR 2

But I can't call it from the install dir ... (no section)

Could u help?
Guest#
Hi DarkLord23

Is this what you want to do?
StrCpy $0 $WINDIR 2
InstallDir "$0\econf"
Good luck.

Greetz, Hendri.
DarkLord23#
I does't work ;(

StrCpy $0 "$WINDIR" (2) ()
Error: Can't add entry, no section or function is open!
Error in script "C:\release\econf.nsi" on line 50 -- aborting creation process
Guest#
So you can only use this command StrCpy in a SECTION or a FUNCTION. Please read NSIS Documentation.

-Hn3.
DarkLord23#
I know that and I've read the doc.

I have tried to declare windir in the onInitSuccess function but it does not work either!

I am stuck!!
Guest#
You shouldn't declare $WINDIR. It's given.

Just do:
function .onInit
StrCpy $0 $WINDIR 2
; Now $0 is the system drive
StrCpy $INSTDIR "$0\MyApp"
; this is to set the default install dir
; to the right choice.
FunctionEnd

Section
File...
SectionEnd
-Hendri.