C# WPF 文件复制,相对路径
/// <summary> /// 下载/复制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Border_MouseLeftButtonUp_4(object sender, MouseButtonEventArgs e) { //获取的文件地址 var path = this.txtbox1.Text; 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"; //将选择的文件复制的地址 File.Copy(path, path2, true); MessageBox.Show(@"已下载到:..\Excel\任务分配管理Excel文件.xls"); }