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