【Vegas原创】定时运行BAT文件(复制文件/打开页面)

2年前 (2022) 程序员胖胖胖虎阿
319 0 0

1.Form.cs:

using CC=System.Web.Mail;
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;
            }
        }


2.Copy.bat

copy \\10.*.*.*\bbb\ccc.xls D:\aa\db


3.Summary.bat

start http://localhost/aaa/ok.aspx

 

相关文章

暂无评论

暂无评论...