NSIS困难移动文件夹 [英] NSIS difficulty moving folders

查看:198
本文介绍了NSIS困难移动文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个寻找旧版本的安装程序,作为卸载过程的一部分,将其备份在一个文件夹中.

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

对于备份,我尝试了Rename(有时会失败),CreateDirectory然后CopyFiles然后将其删除(这很耗时,文件和目录很多),并且更喜欢使用

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" "*.*"

一切正常...

但是我正在使用以下方法启动卸载程序:

Yet I was launching the uninstaller with:

ExecWait '$R0'

我将其更改为

ExecWait '$R0 _?=$INSTDIR'

MoveFile出现错误.

The MoveFile gives an error.

推荐答案

在不使用_?=的情况下运行卸载程序会导致卸载程序将自身复制到$ temp,然后从那里运行新实例(无需等待).您应该尝试混合使用;将您自己的卸载程序复制到$ temp并使用_?= $ instdir运行它,这应该允许您等待该过程而无需锁定$ instdir ...

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...

这篇关于NSIS困难移动文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆