简体   繁体   English

如何检查文件是否被其他进程NSIS锁定/使用

[英]How to check if file locked/used by other process NSIS

Hi I am writing nsis script for a patch installer. 嗨,我正在为补丁安装程序编写nsis脚本。 Before installer copies new files I need to check if any process is using the files I want to replace and I want rename those files to tmp and delete them on reboot. 在安装程序复制新文件之前,我需要检查是否有任何进程正在使用要替换的文件,并且要将这些文件重命名为tmp并在重新启动时将其删除。 Is there any way installer can detect that if any process is using those files (in my case the files I am going to install are dlls). 安装程序是否可以通过任何方式检测到是否有任何进程正在使用这些文件(在我的情况下,我将要安装的文件是dll)。

There is no native way in NSIS how to do this. NSIS中没有本地方法可以执行此操作。 But there are third party tools which can detect dlls used by certain process - maybe you could use them in your installer. 但是有些第三方工具可以检测某些进程使用的dll-也许您可以在安装程序中使用它们。

But my question is: Do you really need to detect this? 但是我的问题是:您真的需要检测到这一点吗?

What about deleting files directly with Delete /REBOOTOK file command? 使用Delete / REBOOTOK file命令直接删除文件怎么办? ( http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.4.11 ) http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.4.11

If /REBOOTOK is specified and the file cannot be deleted then the file is deleted when the system reboots. 如果指定了/ REBOOTOK并且无法删除该文件,则在系统重新引导时将删除该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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