我正在尝试将一个 .exe 文件从临时目录复制到桌面,但是当我这样做时,它只会创建一个新的 .exe,其中没有数据,大小为 0 KB。我用一个 .txt 文件测试了这个语法,它完全复制了它,它只是出于某种原因拒绝复制 .exe 文件。我尝试使用 string path
执行它以确保它正在抓取正确的位置并且有效,在临时目录中执行 helloworld.exe 程序。我也没有收到任何编译器错误,我在 Windows 7 x86 上。谢谢!
string path = Path.GetTempPath() + "helloworld.exe"; // grabing the temp directory
string path2 = "C:\\users\\grant\\desktop\\helloworld.exe"; //this is where i want
//it to copy to
File.Copy(path, path2, true); //copying the 2 paths
Process.Start(path); //running the .exe in the temp directory to test if it works
最佳答案
.exe
是否在复制过程中使用?
或者,AV 软件是否有可能阻止您的应用制作 .exe
副本?
关于c# - 菜鸟 file.copy 问题在复制 .exe 文件时出现问题 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5972031/