1
我使用C#和我可以複製所有類型的我想要的文件,但是當我想警察快捷方式或鏈接文件c#象這樣的錯誤:C#確實沒有複製shotcut文件
這是我的代碼:
private void button1_Click(object sender, EventArgs e)
{
string fileName = "HonarVaMemar.exe";
string sourcePath = @Application.StartupPath;
string targetPath = @Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Output HonamrvaMemar Version";
// Use Path class to manipulate file and directory paths.
string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
// To copy a folder's contents to a new location:
// Create a new target folder, if necessary.
if (!System.IO.Directory.Exists(targetPath))
{
System.IO.Directory.CreateDirectory(targetPath);
}
System.IO.File.Copy(sourceFile, destFile, true);
//-----------------------------------------------------------
string fileName2 = "HonarVaMemar.exe.lnk";
string sourceFile2 = System.IO.Path.Combine(sourcePath, fileName2);
string destFile2 = System.IO.Path.Combine(targetPath, fileName2);
System.IO.File.Copy(sourceFile2, destFile2, true);}
其他所有文件都複製
.....
點擊「詳細信息」可能會顯示值得信息 – Plutonix