使用Windows 7-32位中的Net Framework 3.5进行VB2008中的编码。My.Computer.FileSystem.SpecialDirectories.MyDocuments在VB2008中返回错误的文件夹名称
代码:
TempUserPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
返回字符串"C:\Users\Owner\Documents"
但该文件夹实际上是一个名为"My Documents"
(即是在Finder "C:\Users\Owner\My Documents"
)。
当我尝试在Owner目录中创建一个名为"Documents"
的新文件夹时,Windows询问我是否想要将其内容与My Documents
文件夹合并。如果我说是的,我只剩下我的文档文件夹,没有一个名字为"Documents"
。
因此,当我尝试读取或写入文件到TempUserPath
位置时,出现"access denied"
错误。甚至在我手动将文件夹的名称从"My Documents"
更改为"Documents"
后,会发生这种情况。
有谁知道为什么Windows在VB环境下似乎将文件名"Documents"
与"My Documents"
等同起来,以及我如何解决这个问题?
您正在编程机器,而不仅仅是使用它。你会发现它在引擎盖下发生了什么,而不仅仅是它看起来像什么。磁盘*上的该目录被命名为“文档”。使用cmd.exe查看真正存在的内容。 – 2011-04-02 17:20:58