I am trying to copy a .exe file from the temp directory to the desktop, however when I do so it just creates a new .exe which has no data in it and is 0 KB in size. I tested this syntax with a .txt file and it copied it completely, it just refuses to copy .exe files for some reason. I tried executing it using the the string path
to make sure it was grabbing the correct location and that worked, executing the helloworld.exe program in the temp directory. Also I do not get any compiler errors, I am on windows 7 x86. Thanks!
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