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,"完成提示"
    

      

    做一个决定,并不难,难的是付诸行动,并且坚持到底。
  • 相关阅读:
    一些端口
    outlook 的微软手册
    目录摘要
    L2TP的包过滤规则
    outlook 的外出时助理程序对外部邮箱不起作用。1个解决办法和另外一个可能性
    用editplus 正则表达式修改联系人表
    Cisco NAT的理解。
    outlook 2003 无法记住密码
    ERD commander 2005的下载地址。
    outlook 2003启用日志记录排除故障。
  • 原文地址:https://www.cnblogs.com/wukc/p/14365850.html
Copyright © 2011-2022 走看看