zoukankan      html  css  js  c++  java
  • 定时运行BAT文件

    引用:https://www.cnblogs.com/lidj/archive/2012/07/07/2580598.html

    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.*.*.*bbccc.xls D:aadb


    3.Summary.bat

    start http://localhost/aaa/ok.aspx
    HK
  • 相关阅读:
    iptables关键学习总结
    iptables关键学习总结
    .net中操作Visual SourceSafe
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
  • 原文地址:https://www.cnblogs.com/HarryK4952/p/14802982.html
Copyright © 2011-2022 走看看