是否安全通過以編程方式引用公用文件夾:如何引用C:用戶編程Public目錄在C#
Directory = System.Environment.GetEnvironmentVariable("public")+"MyCompanyName" // etc.
,或是否有更好的辦法?
再說一遍,如果某人刪除公開的環境變量,並且可以安全地用於不同的語言操作系統?
此如下:How to install to the Public directory in Windows 7 from the VS 2010 deployment Setup Project
作爲邊注,我建議使用[Path.Combine](http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx)反對連接目錄。 – 2011-01-10 18:08:36
你擔心與Windows XP的向後兼容性嗎? %public%環境變量似乎已在Vista中引入; WinXP有%allusersprofile%環境變量指向%systemdrive%\ Documents and Settings \ All Users,但%public%未定義。 – 48klocs 2011-01-10 18:12:35
感謝您的信息;沒有,這純粹是Vista/7。 – Jeb 2011-01-11 09:33:19