您的位置:首页 > 编程语言 > C#

c# 拷贝文件到"启动"文件夹中

2007-09-03 20:07 405 查看
有时候为了让程序开机就启动,可以直接将程序复制到"启动"文件夹中.

代码:




string StartupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);


//获得文件的当前路径


string dir = Directory.GetCurrentDirectory();


//获取可执行文件的全部路径


string exeDir = dir + "WindowsApplication1.exe";


System.IO.File.Copy(exeDir, StartupPath + "WindowsApplication1.exe", true);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐