本文介绍了Visual Basic 2010-拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

您好,我是编程新手,只工作了几个月.我正在尝试制作一个非常简单的备份程序,该程序备份c:\ users \ dave \ appdata中的所有Appdata文件夹. (窗口7)我尝试了几种方法,包括以下所列:-

1)My.Computer.FileSystem.CopyDirectory("c:\ users \ dave \ APPDATA","d:\ server \ users \ dave \ appdata",覆盖:= True)

尝试此操作时,我拒绝访问路径c:\ users \ dave \ appdata \ roaming \ application data \.
同样,这种方式也可以复制目录名称,但文件夹为空.

2)My.Computer.FileSystem.CopyDirectory("c:\ users \ dave \ appdata \","d:\ server \ users \ dave",FileIO.UIOption.AllDialogs,FileIO.UICancelOption.DoNothing)

3)也尝试使用getfiles和getdirectories,但与数字1相同.

以这种方式执行操作时,它确实允许我访问并进行复制,但会不断出现对话框,提示此操作无法完成,因为文件已打开"等.我希望此操作在晚上在我的计算机上运行,​​并且不希望用户进行交互.

我尝试关闭UAC并选择和取消选择一键,但仍然无法使其正常工作.我也知道我的文档"未复制的问题,因为它实际上称为文档".

我可以使用DOS Xcopy,但是它击败了我确实想要一个不错的GUI且根本不想使用DOS的对象.

对不起,详细的解释!希望有人能提供帮助,因为我已经尽力尝试了一切,并且一发不可收拾!!!!

预先感谢Dave.

Hi there , I am new to programming only been doing it for a few months. I am attempting to make a very easy backup program that backs up all of Appdata folder in c:\users\dave\appdata. ( window 7 ) I have tried several ways including listed below :-

1) My.Computer.FileSystem.CopyDirectory("c:\users\dave\APPDATA", "d:\server\users\dave\appdata", overwrite:=True)

When trying this i get " access to path c:\users\dave\appdata\roaming\application data\ is denied.
Also this way does copy the directory name but folders are empty.

2) My.Computer.FileSystem.CopyDirectory("c:\users\dave\appdata\", "d:\server\users\dave", FileIO.UIOption.AllDialogs, FileIO.UICancelOption.DoNothing)

3) Also tried getfiles & getdirectories but does the same as number 1.

When doing it this way it does allow me access and does copy but keep getting dialogs saying " this action can not be complete because the file is open " etc. I wanted this to run at night on my computers at work and didnt want user interaction.

I have tried turning UAC off and selecting and de-selecting one click but still cant get it to work. I am also aware of the issues with "My documents " not copying because its actually called " Documents ".

I could use DOS Xcopy but it defeats the object i realy wanted a nice GUI and didnt want to use DOS at all.

Sorry for the long explanation !!!!! Hopefully someone can help as i have tried everything within my power and am out of steam !!!

Thanks in advance, Dave.

推荐答案




这篇关于Visual Basic 2010-拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 16:46