使用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