12

I am looking for the environment variable for AppData in NSIS. I need to copy fils to the AppData directory in my installation.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
kakka47
  • 3,479
  • 8
  • 44
  • 52

2 Answers2

18

It can't be easier than this $APPDATA, you can do something like this:

SetShellVarContext all
!define INSTDIR_DATA "$APPDATA\MyApp" ; call "SetShellVarContext all" before!
sorin
  • 161,544
  • 178
  • 535
  • 806
  • Perfect. I found this link as well, if someone wants to read more: http://wilsont3ch.com/about-portables-2/more-file-management/ – kakka47 Jun 14 '11 at 06:17
8

$APPDATA is already defined as constant in NSIS.

The application data directory. Detection of the current user path requires Internet Explorer 4 and above. Detection of the all users path requires Internet Explorer 5 and above. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

Slappy
  • 5,250
  • 1
  • 23
  • 29