开发者

I want my C# winforms program to copy it self to system32

开发者 https://www.devze.com 2023-02-07 08:36 出处:网络
I\'ve made a C开发者_如何学运维# windows forms application and want this application to copy itself (the file of the program) to the system32 of the current system. I want such function:

I've made a C开发者_如何学运维# windows forms application and want this application to copy itself (the file of the program) to the system32 of the current system. I want such function:

function copyProg() {
   //copy the program to the system32 of current windows version...
   //return the new url
}


This is a "bad idea" and "frowned upon". A cleaner and more accepted practice is to create an environment variable that points to your applications startup directory.

string localPath = Application.StartupPath;
Environment.SetEnvironmentVariable("EXAMPLE", localPath);
0

精彩评论

暂无评论...
验证码 换一张
取 消