public static void LogInfo(string pMessage)
{
string Path = @"C:\\WINDOWS\system32\net.exe";//使用windows開啟網路磁碟機連線
Process.Start(Path,@"use v: \\172.16.10.25\vip\MSS m20717 /user:tedomain\thwc74");
//設定v槽及網路磁碟機連線帳號密碼
string logFile = "v:\\Vip_DailyReport_Log.txt";//Debug log 檔案名稱
if (File.Exists(logFile))
{
File.AppendAllText(logFile, pMessage + "\r\n");
//如果檔案存在就繼續寫log
}
else
{
FileStream fs = new FileStream(logFile, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs); //檔案不存在就寫新檔
sw.WriteLine(pMessage);
sw.Close();
fs.Close();
}
}
{
string Path = @"C:\\WINDOWS\system32\net.exe";//使用windows開啟網路磁碟機連線
Process.Start(Path,@"use v: \\172.16.10.25\vip\MSS m20717 /user:tedomain\thwc74");
//設定v槽及網路磁碟機連線帳號密碼
string logFile = "v:\\Vip_DailyReport_Log.txt";//Debug log 檔案名稱
if (File.Exists(logFile))
{
File.AppendAllText(logFile, pMessage + "\r\n");
//如果檔案存在就繼續寫log
}
else
{
FileStream fs = new FileStream(logFile, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs); //檔案不存在就寫新檔
sw.WriteLine(pMessage);
sw.Close();
fs.Close();
}
}
沒有留言:
張貼留言