Furkan Karagulle

Furkan Karagulle

  • NA
  • 30
  • 3.3k

C# File Copy Problem

Dec 1 2020 7:31 PM
Hi, I'm trying to get a copy of my application to the launch folder.
 
However, although I did not get an error, my code block does not work and my file is not copied.
 
I would be happy if you could help.
  1. static void ExeCopy()  
  2. {  
  3. if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Start Menu\Programs\Startup\securpass.exe"))  
  4. {  
  5. File.Copy(Path.GetFileName(Application.ExecutablePath), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Start Menu\Programs\Startup\securpass.exe");  
  6. }  
  7. }  

Answers (7)