user1004287
user1004287

Reputation: 23

NSIS - Copy the installer itself

I'd like to copy the installer to the installed location.

I'm running the file: Installer.exe and I'd like that it would copy itself to $INSTDIR

I tried:

CopyFiles "Installer.exe" "$INSTDIR\Installer.exe"

I get "Copy Failed" in the installation log.

tried to open source, read source, open dest, write dest:

  FileOpen $4 "Installer.exe" r
  FileRead $4 $1 80000
  FileClose $4

  FileOpen $4 "$INSTDIR\Installer.exe" w
  FileWrite $4 $1
  FileClose $4

It creates $INSTDIR\Installer.exe but after the installation progress it got 0 bytes in it.

Do you have another way to do it?

Thanks!

Upvotes: 2

Views: 1001

Answers (1)

Anders
Anders

Reputation: 101764

You should use full paths, $ExePath is the full path to the installer itself...

CopyFiles "$ExePath" "$InstDir\"

Upvotes: 3

Related Questions