zoukankan      html  css  js  c++  java
  • windows中日期自动替换

    环境:windows、cmd

    要求:一个配置文件中有日期,程序执行一次日期自动加一天。

    链接: https://pan.baidu.com/s/1SJir4jMfJCdQmLkdkqdI5Q 提取码: di2n 

    文件三个:

        param.properties      参数文件需要修改其中日期

        delete.bat                 执行脚本,执行一次日期自动加一天

       0systemupdate.vbs   vbs脚本,调用delete脚本,多次执行(只用双击该文件完成功能)

    下面是脚本内容:

    param.properties 
    rmDir=/5101/20201232,/5103/20201232,/5104/20201232,/5105/20201232 
    -------------------------
    delete.bat 
    @echo off
    chcp 65001
    @echo off
    :: 找到文件,找到日期, 替换日期,月底需要修改parame到月初时间
    setlocal enabledelayedexpansion
    set file=.param.properties
    for %%i in ("%file%") do set file=%%~fi
    echo.
    for /f "delims=/,  tokens=1,3" %%i in (.param.properties) do set replaced=%%j
    echo befor:%replaced%
    echo.
    set all=
    set num2=1
    set /a all = !replaced!+!num2!
    echo after:%all%
    
    for /f "delims=" %%i in ('type "%file%"') do (
         set str=%%i
         set "str=!str:%replaced%=%all%!"
         echo !str!>>"%file%"_tmp.txt
    )
    move "%file%"_tmp.txt "%file%"
    exit  
    ---------------------------      
    0systemupdate.vbs 
    set wshshell=createobject("wscript.shell")
    wshshell.run "delete.bat",1,true
    wshshell.run "delete.bat",1,true
    MsgBox  "提示语",title,"完成提示"
    

      

    做一个决定,并不难,难的是付诸行动,并且坚持到底。
  • 相关阅读:
    zookeeper 初步学习
    nginx+redis+4个tomcat 负载均衡
    nginx的配置文件解析
    nginx-----惹不起的端口修改
    Api2Doc生成 Restful API 文档
    swagger2 注解整体说明
    SpringMVC 中xml 配置多数据源
    lombok 注解使用
    springboot 中 集成druid ,redis
    spring学习---day01
  • 原文地址:https://www.cnblogs.com/wukc/p/14365850.html
Copyright © 2011-2022 走看看