如何在C#中获取当前用户的桌面path?
如何获得C#中当前用户的桌面path?
我唯一能find的就是VB.NET类SpecialDirectories
,它有这个属性:
My.Computer.FileSystem.SpecialDirectories.Desktop
我怎样才能在C#中做到这一点?
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string extension = ".log"; filePath += @"\Error Log\" + extension; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); }