WPF 获取文件夹路径,目录路径,复制文件,选择下载文件夹/目录
private void Border_MouseLeftButtonUp_4(object sender, MouseButtonEventArgs e) { //获取项目中文件 string WantedPath = System.Windows.Forms.Application.StartupPath.Substring(0, System.Windows.Forms.Application.StartupPath.LastIndexOf(@"\")); string path2 = System.IO.Path.GetDirectoryName(WantedPath); path2 = path2 + @"\Excel\任务分配管理Excel文件.xls"; //用户选择目录 System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); fbd.ShowDialog(); var s = fbd.SelectedPath; if (fbd.SelectedPath != string.Empty) { File.Copy(path2, fbd.SelectedPath + "\\任务分配管理Excel文件.xls", true); MessageBox.Show("下载完毕"); } }