Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hİ! Copies of the program itself when opened. how can i do . ??

C#
private void Form1_Load(object sender, EventArgs e)
       {
            Copies of the program itself. C:/ (how can I do ?)
       }
Posted

Use Application.ExecutablePath Property[^] to get the current path and file name and then use File.Copy Method[^] to copy the file to a new folder.
Perhaps use Path class[^] to get something like folder it self or file name and then combine a new path before use of File.Copy.
 
Share this answer
 
v2
Comments
Simon Bang Terkildsen 1-Oct-11 13:04pm    
My five
Kim Togo 1-Oct-11 13:12pm    
Thanks Simon.
Espen Harlinn 1-Oct-11 13:09pm    
5'ed!
Kim Togo 1-Oct-11 13:12pm    
Thanks Espen.
Simon Bang Terkildsen 1-Oct-11 13:38pm    
OP wrote:
someone send me source :( ......
I could not.
C#
File.Copy("MyApplication.exe", @"C:\path\MyApplication.exe");
 
Share this answer
 
Comments
Espen Harlinn 1-Oct-11 13:09pm    
5'ed!
Simon Bang Terkildsen 1-Oct-11 13:50pm    
Thank you for the vote, Espen
Kim Togo 1-Oct-11 13:13pm    
My 4 for a simple answer.
Simon Bang Terkildsen 1-Oct-11 13:50pm    
Thank you, Kim.
Simon Bang Terkildsen 1-Oct-11 13:37pm    
OP wrote:
someone send me source :( ......
I could not.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900