【Vegas原创】定时运行BAT文件(复制文件/打开页面)
1.Form.cs:
using CC=System.Web.Mail;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Diagnostics;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Diagnostics;
private void timer1_Tick(object sender, System.EventArgs e)
{
//早8:00更新excel 精确到毫秒,否则会蹦出6个bat
if (DateTime.Now.ToString("HH:mm:ss.f")=="08:00:00.0")
{
//声明一个程序信息类
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
//设置外部程序名
Info.FileName = "Copy.bat";
Info.WorkingDirectory = "D:\\aa\\bb\\BAT";
//声明一个程序类
System.Diagnostics.Process Proc ;
//启动外部程序
Proc = System.Diagnostics.Process.Start(Info);
}
//9:00 发送Summary
else if (DateTime.Now.ToString("HH:mm:ss.f")=="09:00:00.0")
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
Info.FileName = "Summary.bat";
Info.WorkingDirectory = "D:\\a\\b\\BAT";
System.Diagnostics.Process Proc ;
Proc = System.Diagnostics.Process.Start(Info);
}
//13:00 发送FEOL
else if (DateTime.Now.ToString("HH:mm:ss.f")=="13:00:00.0")
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
Info.FileName = "FEOL.bat";
Info.WorkingDirectory = "D:\\a\\b\\BAT";
System.Diagnostics.Process Proc ;
Proc = System.Diagnostics.Process.Start(Info);
}
//否则循环
else
{
return;
}
}
{
//早8:00更新excel 精确到毫秒,否则会蹦出6个bat
if (DateTime.Now.ToString("HH:mm:ss.f")=="08:00:00.0")
{
//声明一个程序信息类
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
//设置外部程序名
Info.FileName = "Copy.bat";
Info.WorkingDirectory = "D:\\aa\\bb\\BAT";
//声明一个程序类
System.Diagnostics.Process Proc ;
//启动外部程序
Proc = System.Diagnostics.Process.Start(Info);
}
//9:00 发送Summary
else if (DateTime.Now.ToString("HH:mm:ss.f")=="09:00:00.0")
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
Info.FileName = "Summary.bat";
Info.WorkingDirectory = "D:\\a\\b\\BAT";
System.Diagnostics.Process Proc ;
Proc = System.Diagnostics.Process.Start(Info);
}
//13:00 发送FEOL
else if (DateTime.Now.ToString("HH:mm:ss.f")=="13:00:00.0")
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
Info.FileName = "FEOL.bat";
Info.WorkingDirectory = "D:\\a\\b\\BAT";
System.Diagnostics.Process Proc ;
Proc = System.Diagnostics.Process.Start(Info);
}
//否则循环
else
{
return;
}
}
2.Copy.bat
copy \\10.*.*.*\bbb\ccc.xls D:\aa\db
3.Summary.bat
start http://localhost/aaa/ok.aspx
喜欢请赞赏一下啦^_^
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步