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");
}