Skip to content
⌘ NSIS Forum Archive

Using Answer files for silent installs

4 posts

jlevy#

Using Answer files for silent installs

I was looking to do a silent install for my installer but i have alot of option. i came across the recommendation in the help file to use an answer file for complex installs, but after that i found nothing talking about this.

Has anyone used these or would it be better to just use complex command line flags for silent installs?

If i should just change up things to make it more silent friendly any good refs would be welcomed.

Thanks guys!
valentz142#
You could use ini file for your answer files
The idea is something like this:
(example to set $INSTDIR from ini file)

; --------------------- Code Begin
; Find MyAnswerFile.ini in same location as installer file
; if could not find goto NoINIFile
IfFileExists `$EXEDIR\MyAnswerFile.ini` 0 NoINIFile

; Read RootPath in Section Install from MyAnswerFile.ini
ReadINIStr $0 `$EXEDIR\MyAnswerFile.ini` Install RootPath

; set installation directory to path in MyAnswerFile.ini
StrCpy $INSTDIR $0

Goto ContinueToNextCode

NoINIFile:
; Set your default value here since no answer file is found
StrCpy $INSTDIR `$PROGRAMFILES\My Program`

ContinueToNextCode:
; Your next code
; --------------------- Code End

MyAnswerFile.ini
----------------
[Install]
RootPath=D:\My Program

Hopefully could help
jlevy#
Thank you valentz142 that makes all that make more sense.

Now if I have a user that needs to use a full command line to use for deploying over a network via GPO. Is there a good way to make an install more command line friendly?

Sorry for the noob question.