如何使用vc ++删除文件夹 [英] How to delete the folder using vc++
本文介绍了如何使用vc ++删除文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要删除IE历史记录.
它位于该路径中.
C:\ Documents and Settings \ admin \ Local Settings \ History
如果我尝试删除,则表示系统无法找到该路径.
而且我无法删除..
你能帮我吗?
我正在使用msdev编辑器
i want to delete the IE history.
It located in that path.
C:\Documents and Settings\admin\Local Settings\History
If i try to delete means it provide system not find the path.
and i can''t able to delete ..
can you help me .
i am using msdev editor
推荐答案
如果您说系统找不到路径",则意味着您可能没有足够的权限.您需要使用提升的特权来运行您的应用程序.在Windows 7(Vista?)上,使用管理员帐户登录是不够的.
请参阅本文,以获取几乎所有可用的以管理员身份运行程序的选项: http://www.sevenforums.com /tutorials/11841-run-administrator.html [ ^ ].
返回删除文件,您可能需要拥有目录的所有权并赋予自己删除的权利.请参阅以下讨论: http://www .howtogeek.com/howto/windows-vista/how-to-delete-a-system-file-in-windows-vista/ [
If you say "system not find the path", it means you may not have enough privileges. You need to run your application with elevated privileges. On Windows 7 (Vista?) logging in with administrator account is not enough.
See this article for nearly all available options to run your program as administrator: http://www.sevenforums.com/tutorials/11841-run-administrator.html[^].
Back to deleting files, you may need to take ownership of the directory and give yourself the right to delete. See this discussion: http://www.howtogeek.com/howto/windows-vista/how-to-delete-a-system-file-in-windows-vista/[^].
Programmatically, you can run the commandstakeown
andcacls
using Windows APICreateProcess
. You can put the commands in one batch file, substitute username and directory name and run the file usingCreateProcess
.
—SA
这篇关于如何使用vc ++删除文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文