NSIS difficulty moving folders

最后都变了- 提交于 2019-12-13 05:44:19

问题


I have an installer that looks for old version, and as part of the uninstall process, backs it up in a folder.

For backup, I have tried Rename (it sometimes fails), CreateDirectory then CopyFiles then delete them (time consuming, lots of files and directories), and have preferred to use Move Folder, where every function is replaced with its un-version (like .MoveFolder_Locate_moveFile -> un.MoveFolder_Locate_moveFile).

StrCpy $switch_overwrite 1
!insertmacro un.MoveFolder "$INSTDIR" "$BACKUP_FOLDER" "*.*"

It was working fine...

Yet I was launching the uninstaller with:

ExecWait '$R0'

As soon as I chnaged it to

ExecWait '$R0 _?=$INSTDIR'

The MoveFile gives an error.


回答1:


Running the uninstaller without _?= causes the uninstaller to copy itself to $temp and then run a new instance from there (without waiting). You should try a hybrid of this; copy the uninstaller yourself to $temp and run it with _?=$instdir, this should allow you to wait for the process without locking $instdir...



来源:https://stackoverflow.com/questions/11937466/nsis-difficulty-moving-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!