无法删除使用服务创建的文件夹 [英] Cannot delete a folder created using a service

查看:81
本文介绍了无法删除使用服务创建的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的应用程序是一项服务,并使用它在C上(在安装了操作系统的情况下)在其中创建一个文件夹和一个文件.
但是,一旦创建,我也无法手动删除它(文件夹中的文件). Windows给出错误-删除文件/文件夹时出错.请确保该文件不受写保护或正在使用中."

当我在其他任何驱动器上创建设备时,说d :,则可以删除该文件夹.

当我运行相同的应用程序而不是作为服务运行时,无论文件是在C:还是D:上创建的,我都可以删除该文件和文件夹.


能否让我知道造成这种情况的可能原因?服务创建文件夹时,可能会限制C:上授予用户的权限.有什么解决办法吗?

预先感谢,
Manasi.

Hi,

My application is a service, and using that i am creating a folder and a file in it, on C: (whr operating system is installed)
However, once that is created, i am unable to delete it (the file within the folder) manually also. windows gives error - "error deleting file/folder. Make sure the file is not write protected or in use."

When i create the fodler on any other drive, say d:, i can delete the folder.

When i run the same application, not as a service, I am able to delete the file and the folder, irrespective on whether it is created on C: or D:.


Can anypne pls let me know the possible cause of the same? Probably the rights given to the user on C: while service is creating the folder are restricted. Is there any solution for this?

Thanks in advance,
Manasi.

推荐答案

在运行服务时,您没有以与帐户用户相同的身份登录.运行您的服务,然后查看其属性:

When you''re running your service, you''re not logged as the same user as that of your account. Run your service, then look at its properties:

%SystemRoot%\system32\services.msc /s



它将显示服务小程序;参见登录为";典型的用户是本地系统",网络服务"等.用于服务的用户应该可以访问您的文件.另一种方法是将服务的安装更改为在系统上注册的某些经过身份验证的用户.

—SA



It will show Services applet; see "Log on as"; the typical users are "Local System", "Network Service", etc. Your files should be accessible by that user you used for your service. The other way is to change installation of the service to some authenticated user registered on your system.

—SA


这篇关于无法删除使用服务创建的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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