private void Copy()
{
string aimpath=@"C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Shut_Explorer.exe";
// string path = System.IO.Directory.GetCurrentDirectory()+"\\Shut_Explorer.exe"; //??
string path=System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;//这种方法好,可以动态获取
if(!System.IO.File.Exists(aimpath))
{
System.IO.File.Copy(path,aimpath);
}
}
//创建文本
string path=@"C:\Documents and Settings\Administrator\\桌面\aa.txt";
if(!File.Exists(path))
{
using(StreamWriter sw=File.CreateText(path))
{
sw.Write("开始了");
}
}
//追加文本
using(StreamWriter sw=File.AppendText(path))
{
sw.WriteLine(BoardID+"以完成");
}
//另一种创建文本
using(StreamWriter sw=new StreamWriter(path,false,Encoding.UTF8))//注意QuickCHM支持utf8编码
{
sw.Write("ererere");
}
http://www.cnblogs.com/wang123/archive/2006/08/22/483092.html