zoukankan      html  css  js  c++  java
  • [BAT]操作系统定时任务调用批处理忽略error继续运行的方法

    如下,通过forfiles删除7天以前生成的一些文件,当不存在满足搜索条件的文件时,就会报错:ERROR: No files found with the specified search criteria.

    手工运行批处理脚本时,遇到这个error,后面的脚本会继续运行,但是,将其加到操作系统的定时任务中,遇到这个error,任务就中断了。

    @echo off

    echo autotest beginning,Please Wait... ...


    set AutoPath=D:CIMAutoTest
    set JmeterPath=D:apache-jmeter-2.7

    forfiles /p %AutoPath%Result /m *.* -d -7 /c "cmd /c del /f @path"
    forfiles /p %JmeterPath%extras /m *.html -d -7 /c "cmd /c del /f @path"

    cd /d %AutoPath%
    ant -f CIMSmokeTest.xml>%AutoPath%Resultlog.txt

    exit

    解决办法:通过>nul 2>nul将error的回显关闭

    @echo off

    echo autotest beginning,Please Wait... ...


    set AutoPath=D:CIMAutoTest
    set JmeterPath=D:apache-jmeter-2.7

    forfiles /p %AutoPath%Result /m *.* -d -7 /c "cmd /c del /f @path">nul 2>nul
    forfiles /p %JmeterPath%extras /m *.html -d -7 /c "cmd /c del /f @path">nul 2>nul

    cd /d %AutoPath%
    ant -f CIMSmokeTest.xml>%AutoPath%Resultlog.txt

    exit

  • 相关阅读:
    xampp服务器搭建和使用
    使用proxyee-down解决百度云下载限速问题
    iOS开发之多线程技术—GCD篇
    iOS 将视频流(h264)和音频流封装成PS流
    iOS 播放音频文件
    iOS 简单socket连接
    ios获取本机网络IP地址方法
    iOS10适配相关
    iOS设备的尺寸和分辨率
    理解NodeJS
  • 原文地址:https://www.cnblogs.com/MasterMonkInTemple/p/3311725.html
Copyright © 2011-2022 走看看