在Windows中删除运行的文件 [英] Delete running file in windows

查看:157
本文介绍了在Windows中删除运行的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些安装程序/卸载程序软件。
在我的Uninst程序中,我需要删除目录中的所有文件和自我文件。
如何在windows中实现这个?运行文件被阻止

I write some installer/uninstaller software. In my Uninst programm I need to delete all files in directory, and self file. How to implement this in windows? Running file is blocked

推荐答案

这不是一个真正的Qt问题,
与Linux和OSX不同,您已经发现,您正在运行的文件已被锁定,因此您无法在运行时删除它。

This is not really a Qt question, but more directly Windows. Unlike Linux and OSX, as you've discovered, the file that you're running is locked, so you can't delete it whilst running.

不过,您可以使用 RunOnce注册表项单独运行程序一次,当用户登录时,它将为您执行文件的最终删除。如文档中所述,RunOnce条目在运行之前被删除,因此它会按预期执行。

What you can do though is use the RunOnce registry key to separately run a program just once, when a user logs in, which will perform the final delete of the files for you. As stated in the documentation, the RunOnce entry is deleted before it is run, so it performs as expected.

这篇关于在Windows中删除运行的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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