简体   繁体   中英

rename file with the name of installer name in NSIS installer?

I'm working with NSIS installer. I need to change file defined in install path to the same installer name.

I try to use rename function like:

Rename "$INSTDIR\app.exe" "$INSTDIR\installname.exe"

but I need the installer name automatic.

Take a look at the constants , $EXEFILE is the filename, or $EXEPATH for the full path. If you want the name attribute you used in your source file, it is $(^Name) ...

From FileFunc header you can combine GetExeName and GetFileName macros to get the installer's name:

!include "FileFunc.nsh"
OutFile test.exe

section main

    ${GetExeName} $R0
    ${GetFileName} "$R0" $R1

    MessageBox MB_OK "My installer's exe is $R1"
sectionend

Now you can test it yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM