C#获取windows 10的下载文件夹路径
Windows没有为“下载”文件夹定义CSIDL,并且通过Environment.SpecialFolder枚举无法使用它。 但是,新的Vista知名文件夹API确实使用ID定义它FOLDERID_Downloads。获取实际值的最简单方法可能是P / invokeSHGetKnownFolderPath。 public static class KnownFolder { public static readonly Guid Downloads = new Guid("374DE290-123F-4565-9164-39C4925E467B"); } [DllImport("shell32.dll", CharSet=CharSet.Unicode)] static extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)] Guid rfid, uint dwFlags, IntPtr hToken, out string pszPath); static void Main(string[] args)...