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.
- static void ExeCopy()
- {
- if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Start Menu\Programs\Startup\securpass.exe"))
- {
- File.Copy(Path.GetFileName(Application.ExecutablePath), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Start Menu\Programs\Startup\securpass.exe");
- }
- }

Amit GuptaRank #190 · 12.8K reputationPosted Dec 2, 2020, 4:35 PM EST
Amit GuptaRank #190 · 12.8K reputationPosted Dec 2, 2020, 4:41 PM EST
Furkan Karagulle27 reputationPosted Dec 5, 2020, 9:30 AM EST
element to:Amit GuptaRank #190 · 12.8K reputationPosted Dec 2, 2020, 12:32 AM EST
Furkan Karagulle27 reputationPosted Dec 3, 2020, 3:00 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Dec 3, 2020, 4:53 AM EST
- The srcPath:- means the path to your File .
- DestinationPath:- means the path where you want to copy your File.
Now , simply find the path where your exe file resides. and deside a folder where you want to copy your exe file.Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 5:46 PM EST