Skip to content
⌘ NSIS Forum Archive

Rename a file

4 posts

monti0505#

Rename a file

Hi all,

I am trying to rename a file when a special radio button is clicked. Buut nothing happens and no error occurs.

I tried like this:


Function MyCustomLeave

!insertmacro INSTALLOPTIONS_READ $R1 "licInfoDlg.ini" "Settings" "State"
ReadINIStr $2 "licinfodlg.ini" "Field 3" "State"

${If} $R1 == 2 # Field 1.
Rename $INSTDIR\bin\filename_old.dll $INSTDIR\bin\filename_new.dll
strcpy $lic_type "Demoversion"
Abort
${EndIf}
${If} $R1 == 3 # Field 1.
Rename $INSTDIR\bin\filename_old.dll $INSTDIR\bin\filename_new.dll
strcpy $lic_type "Seriennummer"
Abort
${EndIf}
${If} $R1 == 6 # Field 1.
Rename $INSTDIR\bin\filename_old_2.dll $INSTDIR\bin\filename_new_2.dll
strcpy $lic_type "Lizensserver"
Abort
${EndIf}

FunctionEnd
Can someone tell me what is going wrong or another possibility to change the name?

Regards
Afrow UK#
Like I said in your other topic, use !insertmacro INSTALLOPTIONS_READ not ReadINIStr. Please stop creating new topics.

Stu
monti0505#
Originally posted by Afrow UK
Like I said in your other topic, use !insertmacro INSTALLOPTIONS_READ not ReadINIStr. Please stop creating new topics.

Stu
In the other topic I did not ask not for renaming a file. Its another subject. Therefore I created this seperate topic. How can I rename files with INSTALLOPTIONS_READ????
Afrow UK#
The problem here has nothing to do with your Rename instructions. It's because you are using ReadINIStr without a full INI file path thus not getting any value from your INI file. Hence why I am telling you the same solution as in all your other topics.

Stu